Example usage for android.content ContentResolver removeStatusChangeListener

List of usage examples for android.content ContentResolver removeStatusChangeListener

Introduction

In this page you can find the example usage for android.content ContentResolver removeStatusChangeListener.

Prototype

public static void removeStatusChangeListener(Object handle) 

Source Link

Document

Remove a previously registered status change listener.

Usage

From source file:com.dogar.geodesic.activities.MainActivity.java

@Override
protected void onDestroy() {
    super.onDestroy();
    if (mSyncObserverHandle != null) {
        ContentResolver.removeStatusChangeListener(mSyncObserverHandle);
        mSyncObserverHandle = null;//from w  w  w  . ja  v a  2s .  c  o m
    }
}

From source file:com.conferenceengineer.android.iosched.ui.HomeActivity.java

@Override
protected void onPause() {
    super.onPause();
    if (mSyncObserverHandle != null) {
        ContentResolver.removeStatusChangeListener(mSyncObserverHandle);
        mSyncObserverHandle = null;/* w  w w  .ja v  a2  s.  c om*/
    }
}

From source file:com.battlelancer.seriesguide.ui.ShowsActivity.java

@Override
protected void onPause() {
    super.onPause();

    if (Utils.isAmazonVersion()) {
        // pause Amazon IAP
        AmazonIapManager.get().deactivate();
    }/*from   w  w w  .j av a  2  s .  com*/

    // stop listening to sync state changes
    if (mSyncObserverHandle != null) {
        ContentResolver.removeStatusChangeListener(mSyncObserverHandle);
        mSyncObserverHandle = null;
    }
}

From source file:de.sindzinski.wetter.ForecastDailyFragment.java

@Override
public void onPause() {
    super.onPause();
    SharedPreferences sp = PreferenceManager.getDefaultSharedPreferences(getActivity());
    sp.unregisterOnSharedPreferenceChangeListener(this);

    if (syncObserverHandle != null) {
        ContentResolver.removeStatusChangeListener(syncObserverHandle);
        syncObserverHandle = null;//from   w w w. j  a va2  s .  c o  m
    }
}

From source file:com.nextgis.ngm_clink_monitoring.activities.MainActivity.java

@Override
protected void onPause() {
    if (!getIntent().getBooleanExtra(FoclConstants.NO_SDCARD, false)) {

        GISApplication app = (GISApplication) getApplication();
        app.setOnAccountAddedListener(null);
        app.setOnAccountDeletedListener(null);
        app.setOnReloadMapListener(null);

        // Remove our synchronization listener if registered
        if (mSyncHandle != null) {
            ContentResolver.removeStatusChangeListener(mSyncHandle);
            mSyncHandle = null;//from   ww  w .  ja v  a  2 s .co  m
        }
    }

    super.onPause();
}

From source file:com.android.exchange.SyncManager.java

private void shutdown() {
    synchronized (sSyncLock) {
        // If INSTANCE is null, we've already been shut down
        if (INSTANCE != null) {
            log("SyncManager shutting down...");

            // Stop our running syncs
            stopServiceThreads();/*from www.  j a v a2 s. co  m*/

            // Stop receivers
            if (mConnectivityReceiver != null) {
                unregisterReceiver(mConnectivityReceiver);
            }
            if (mBackgroundDataSettingReceiver != null) {
                unregisterReceiver(mBackgroundDataSettingReceiver);
            }

            // Unregister observers
            ContentResolver resolver = getContentResolver();
            if (mSyncedMessageObserver != null) {
                resolver.unregisterContentObserver(mSyncedMessageObserver);
                mSyncedMessageObserver = null;
            }
            if (mMessageObserver != null) {
                resolver.unregisterContentObserver(mMessageObserver);
                mMessageObserver = null;
            }
            if (mAccountObserver != null) {
                resolver.unregisterContentObserver(mAccountObserver);
                mAccountObserver = null;
            }
            if (mMailboxObserver != null) {
                resolver.unregisterContentObserver(mMailboxObserver);
                mMailboxObserver = null;
            }
            unregisterCalendarObservers();

            // Remove account listener (registered with AccountManager)
            if (mAccountsUpdatedListener != null) {
                AccountManager.get(this).removeOnAccountsUpdatedListener(mAccountsUpdatedListener);
                mAccountsUpdatedListener = null;
            }

            // Remove the sync status change listener (and null out the observer)
            if (mStatusChangeListener != null) {
                ContentResolver.removeStatusChangeListener(mStatusChangeListener);
                mStatusChangeListener = null;
                mSyncStatusObserver = null;
            }

            // Clear pending alarms and associated Intents
            clearAlarms();

            // Release our wake lock, if we have one
            synchronized (mWakeLocks) {
                if (mWakeLock != null) {
                    mWakeLock.release();
                    mWakeLock = null;
                }
            }

            INSTANCE = null;
            sServiceThread = null;
            sStop = false;
            log("Goodbye");
        }
    }
}