@Override protected void onPause() { Logs.d(this, "onPause"); if (mService != null && mService.getBinder() != null) { // unbindService(myConnection); doUnbindService(); } super.onPause(); }
@Override protected void onResume() { AlarmManager am = (AlarmManager) getSystemService(ALARM_SERVICE); Intent i = new Intent(this.getApplicationContext(), MyService.class); PendingIntent pi = PendingIntent.getService(this, 0, i, 0); am.cancel(pi); double minutes = 1; // by my own convention, minutes <= 0 means notifications are disabled if (minutes > 0) { am.setInexactRepeating( AlarmManager.RTC_WAKEUP, SystemClock.elapsedRealtime() + (long) minutes * 60 * 1000, (long) minutes * 60 * 1000, pi); } Logs.d(this, "onResume"); if (mService == null || mService.getBinder() == null) { doBindService(); } super.onResume(); }
@Override public IBinder onBind(Intent intent) { return messenger.getBinder(); }
/** Factory method that returns the underlying IBinder associated with the Request Messenger. */ @Override public IBinder onBind(Intent intent) { super.onBind(intent); // Return the iBinder associated with the Request Messenger. return mRequestMessenger.getBinder(); }
// no binding allowed for this, so return null public IBinder getBinder() { return mServerMessenger.getBinder(); }
@Override public IBinder onBind(Intent intent) { Log.d(LogUtil.TAG, "JoyplusSearchService onBind"); return messenger.getBinder(); }
/** * When binding to the service, we return an interface to our messenger for sending messages to * the service. */ @Override public IBinder onBind(Intent intent) { Log.i(TAG, "binding"); bindCount++; return mMessenger.getBinder(); }
public void testGetBinder() { Messenger messenger = new Messenger(mIBinder); assertSame(mIBinder, messenger.getBinder()); assertNotNull(mMessenger.getBinder()); }
public void testHashCode() { assertEquals(mMessenger.getBinder().hashCode(), mMessenger.hashCode()); }
@Override public IBinder onBind(final Intent intent) { FLog.i(TAG, "onBind"); mFrontMessenger = null; return mMessenger.getBinder(); }
@Override public IBinder onBind(Intent intent) { Toast.makeText(this, "Service bounded", Toast.LENGTH_SHORT).show(); return mMessenger.getBinder(); }
@Override public IBinder onBind(Intent intent) { Log.i(LOGTAG, "onBind"); return mMessenger.getBinder(); }
public IBinder getBinder() { mIsBound = true; return mSelfMessenger.getBinder(); }