@Override public IBinder onBind(final Intent intent) { if (DEBUG) { Log.i(TAG, "bind"); } hasBoundUsers = true; stopHandler.doNotStop(); return getBinder(); }
/** * Return an instance of {@link com.stanfy.enroscar.goro.Goro} managed by this service. * Should be called from the main thread. */ public Goro getGoro() { return getBinder().goro(); }
@Override public IBinder onBind(final Intent intent) { if (DEBUG) { Log.w("Goro", "bind"); } hasBoundUsers = true; stopHandler.doNotStop(); return getBinder(); }
@Override public int onStartCommand(final Intent intent, final int flags, final int startId) { if (intent != null) { Callable<?> task = getTaskFromExtras(intent); if (task != null) { injectContext(task); String queueName = intent.hasExtra(EXTRA_QUEUE_NAME) ? intent.getStringExtra(EXTRA_QUEUE_NAME) : Goro.DEFAULT_QUEUE; ObservableFuture<?> future = getBinder().goro.schedule(queueName, task); if (!intent.getBooleanExtra(EXTRA_IGNORE_ERROR, false)) { ensureErrorWillBeThrown(future); } } } return START_STICKY; }
@Override public int onStartCommand(final Intent intent, final int flags, final int startId) { if (intent != null) { Callable<?> task = getTaskFromExtras(intent); if (task != null) { injectContext(task); String queueName = intent.hasExtra(EXTRA_QUEUE_NAME) ? intent.getStringExtra(EXTRA_QUEUE_NAME) : Goro.DEFAULT_QUEUE; ObservableFuture<?> future = getBinder().goro.schedule(queueName, task); if (!intent.getBooleanExtra(EXTRA_IGNORE_ERROR, false)) { ensureErrorWillBeThrown(future); } } if (intent.hasExtra(EXTRA_NOTIFICATION_BUNDLE)) { Bundle bundle = intent.getBundleExtra(EXTRA_NOTIFICATION_BUNDLE); if (bundle != null) { Notification notification = bundle.getParcelable(EXTRA_NOTIFICATION); int notificationId = intent.getIntExtra(EXTRA_NOTIFICATION_ID, 0); if (notification != null) { startForeground(notificationId, notification); } } } } return START_STICKY; }