public static void register(Context context) { if (sRegisteredCount++ != 0) { // Already registered return; } sInstance.start(context); }
public static void unregister() { if (sRegisteredCount == 0) { Log.w(LOGTAG, "register/unregister mismatch"); return; } if (--sRegisteredCount != 0) { // Should still be registered return; } sInstance.stop(); }