public void onServiceDisconnected(ComponentName name) {
   try {
     mService.unregisterCallback(mCallback);
   } catch (RemoteException e) {
     Log.e(TAG, "RemoteException", e);
   }
   mService = null;
 }
 public void onServiceConnected(ComponentName name, IBinder service) {
   mService = IUpdateCheckService.Stub.asInterface(service);
   try {
     mService.registerCallback(mCallback);
   } catch (RemoteException e) {
     Log.e(TAG, "RemoteException", e);
   }
 }
 @Override
 protected Void doInBackground(Void... arg0) {
   if (mBound) {
     try {
       while (mService == null) {
         // Wait till the Service is bound
       }
       mService.checkForUpdates();
     } catch (RemoteException e) {
       Log.e(TAG, "Exception on calling UpdateCheckService", e);
     }
   }
   return null;
 }