From 7cf75c7cac92ebd7f382f228af40bdb98cbed437 Mon Sep 17 00:00:00 2001 From: Martin Fietz Date: Thu, 6 Sep 2018 16:47:17 +0200 Subject: [PATCH] 2815 Enqueue jobs with a unique job id per class As Job IDs must be unique per uid, use IDs that no one else will use... --- .../danoeh/antennapod/core/service/GpodnetSyncService.java | 5 ++++- .../antennapod/core/service/PlayerWidgetJobService.java | 5 ++++- 2 files changed, 8 insertions(+), 2 deletions(-) diff --git a/core/src/main/java/de/danoeh/antennapod/core/service/GpodnetSyncService.java b/core/src/main/java/de/danoeh/antennapod/core/service/GpodnetSyncService.java index de040603d..fe6e8c400 100644 --- a/core/src/main/java/de/danoeh/antennapod/core/service/GpodnetSyncService.java +++ b/core/src/main/java/de/danoeh/antennapod/core/service/GpodnetSyncService.java @@ -45,6 +45,7 @@ import de.danoeh.antennapod.core.util.gui.NotificationUtils; * This class also provides static methods for starting the GpodnetSyncService. */ public class GpodnetSyncService extends JobIntentService { + private static final String TAG = "GpodnetSyncService"; private static final long WAIT_INTERVAL = 5000L; @@ -61,8 +62,10 @@ public class GpodnetSyncService extends JobIntentService { private static boolean syncSubscriptions = false; private static boolean syncActions = false; + private static final int JOB_ID = -17000; + private static void enqueueWork(Context context, Intent intent) { - enqueueWork(context, GpodnetSyncService.class, 0, intent); + enqueueWork(context, GpodnetSyncService.class, JOB_ID, intent); } @Override diff --git a/core/src/main/java/de/danoeh/antennapod/core/service/PlayerWidgetJobService.java b/core/src/main/java/de/danoeh/antennapod/core/service/PlayerWidgetJobService.java index 2fd790ac7..4f0da82fb 100644 --- a/core/src/main/java/de/danoeh/antennapod/core/service/PlayerWidgetJobService.java +++ b/core/src/main/java/de/danoeh/antennapod/core/service/PlayerWidgetJobService.java @@ -26,13 +26,16 @@ import de.danoeh.antennapod.core.receiver.PlayerWidget; * Updates the state of the player widget */ public class PlayerWidgetJobService extends JobIntentService { + private static final String TAG = "PlayerWidgetJobService"; private PlaybackService playbackService; private final Object waitForService = new Object(); + private static final int JOB_ID = -17001; + public static void updateWidget(Context context) { - enqueueWork(context, PlayerWidgetJobService.class, 0, new Intent(context, PlayerWidgetJobService.class)); + enqueueWork(context, PlayerWidgetJobService.class, JOB_ID, new Intent(context, PlayerWidgetJobService.class)); } @Override