private void terminate() { mApiClient.unregisterConnectionCallbacks(this); mApiClient.unregisterConnectionFailedListener(this); mState = STATE_TERMINATED; } }
@Override protected void onDestroy() { super.onDestroy(); mGoogleApiClient.unregisterConnectionCallbacks(this); mGoogleApiClient.unregisterConnectionFailedListener(this); mGoogleApiClient = null; // unbind if we were bound to the service. unbindService(mServiceConnection); LocalBroadcastManager.getInstance(this).unregisterReceiver(mServiceBroadcastReceiver); }
/** * Opts in or out of connection retrying. The client will attempt to connect again after some * connection failures. * * Enabling or disabling it while it is already enabled or disabled has no effect. */ public void enableConnectionRetrying(boolean enabled) { if (enabled) { mClient.registerConnectionCallbacks(this); mClient.registerConnectionFailedListener(this); } else { mClient.unregisterConnectionCallbacks(this); mClient.unregisterConnectionFailedListener(this); } }
@Override protected void onDestroy() { super.onDestroy(); mGoogleApiClient.unregisterConnectionCallbacks(this); mGoogleApiClient.unregisterConnectionFailedListener(this); mGoogleApiClient = null; // If we were bound to the service, disconnect and unbind. The service will terminate itself when disconnected. if (mBinder != null) { mBinder.disconnect(); } unbindService(mServiceConnection); LocalBroadcastManager.getInstance(this).unregisterReceiver(mServiceBroadcastReceiver); }
void clearGoogleApiClient() { googleApiClient.unregisterConnectionCallbacks(this); googleApiClient.unregisterConnectionFailedListener(this); if (googleApiClient.isConnected()) { removeLocationUpdates(); } googleApiClient.disconnect(); }