コード例 #1
0
 /** Schedules the notification updater task if it hasn't been scheduled yet. */
 private void setupNotificationUpdater() {
   if (BuildConfig.DEBUG) Log.d(TAG, "Setting up notification updater");
   if (notificationUpdater == null) {
     notificationUpdater = new NotificationUpdater();
     notificationUpdaterFuture =
         schedExecutor.scheduleAtFixedRate(notificationUpdater, 5L, 5L, TimeUnit.SECONDS);
   }
 }
コード例 #2
0
  @Override
  public void onDestroy() {
    if (BuildConfig.DEBUG) Log.d(TAG, "Service shutting down");
    isRunning = false;
    updateReport();

    stopForeground(true);
    NotificationManager nm = (NotificationManager) getSystemService(NOTIFICATION_SERVICE);
    nm.cancel(NOTIFICATION_ID);

    downloadCompletionThread.interrupt();
    syncExecutor.shutdown();
    schedExecutor.shutdown();
    feedSyncThread.shutdown();
    cancelNotificationUpdater();
    unregisterReceiver(cancelDownloadReceiver);

    DBTasks.autodownloadUndownloadedItems(getApplicationContext());
  }
コード例 #3
0
ファイル: GreenhouseScheduler.java プロジェクト: zpublic/dozy
 public void repeat(Runnable event, long initialDelay, long period) {
   scheduler.scheduleAtFixedRate(event, initialDelay, period, TimeUnit.MILLISECONDS);
 }
コード例 #4
0
ファイル: GreenhouseScheduler.java プロジェクト: zpublic/dozy
 public void schedule(Runnable event, long delay) {
   scheduler.schedule(event, delay, TimeUnit.MILLISECONDS);
 }