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());
  }