Exemplo n.º 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);
   }
 }
Exemplo n.º 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());
  }
Exemplo n.º 3
0
 public void repeat(Runnable event, long initialDelay, long period) {
   scheduler.scheduleAtFixedRate(event, initialDelay, period, TimeUnit.MILLISECONDS);
 }
Exemplo n.º 4
0
 public void schedule(Runnable event, long delay) {
   scheduler.schedule(event, delay, TimeUnit.MILLISECONDS);
 }