/** Disconnect and unregister the service. */ protected void disconnectService() { if (mIsBound) { if (mService != null) { try { mService.unregisterCallback(mServiceCallback); } catch (RemoteException e) { // Service crashed, not much we can do. } } unbindService(mConnection); mIsBound = false; } }