+
+ // add AccountsUpdatedListener
+ AccountManager am = AccountManager.get(getApplicationContext());
+ am.addOnAccountsUpdatedListener(this, null, false);
+ }
+
+ /**
+ * Service clean up
+ */
+ @Override
+ public void onDestroy() {
+ Log_OC.v(TAG, "Destroying service" );
+ mBinder = null;
+ mServiceHandler = null;
+ mServiceLooper.quit();
+ mServiceLooper = null;
+ mNotificationManager = null;
+
+ // remove AccountsUpdatedListener
+ AccountManager am = AccountManager.get(getApplicationContext());
+ am.removeOnAccountsUpdatedListener(this);
+
+ super.onDestroy();