Merge pull request #2816 from AntennaPod/bugfix/2815-unique-job-id-per-class

Enqueue jobs with a unique job id per class
This commit is contained in:
H. Lehmann 2018-09-21 23:35:03 +02:00 committed by GitHub
commit aad32c98c3
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 8 additions and 2 deletions

View File

@ -45,6 +45,7 @@ import de.danoeh.antennapod.core.util.gui.NotificationUtils;
* This class also provides static methods for starting the GpodnetSyncService. * This class also provides static methods for starting the GpodnetSyncService.
*/ */
public class GpodnetSyncService extends JobIntentService { public class GpodnetSyncService extends JobIntentService {
private static final String TAG = "GpodnetSyncService"; private static final String TAG = "GpodnetSyncService";
private static final long WAIT_INTERVAL = 5000L; private static final long WAIT_INTERVAL = 5000L;
@ -61,8 +62,10 @@ public class GpodnetSyncService extends JobIntentService {
private static boolean syncSubscriptions = false; private static boolean syncSubscriptions = false;
private static boolean syncActions = false; private static boolean syncActions = false;
private static final int JOB_ID = -17000;
private static void enqueueWork(Context context, Intent intent) { private static void enqueueWork(Context context, Intent intent) {
enqueueWork(context, GpodnetSyncService.class, 0, intent); enqueueWork(context, GpodnetSyncService.class, JOB_ID, intent);
} }
@Override @Override

View File

@ -26,13 +26,16 @@ import de.danoeh.antennapod.core.receiver.PlayerWidget;
* Updates the state of the player widget * Updates the state of the player widget
*/ */
public class PlayerWidgetJobService extends JobIntentService { public class PlayerWidgetJobService extends JobIntentService {
private static final String TAG = "PlayerWidgetJobService"; private static final String TAG = "PlayerWidgetJobService";
private PlaybackService playbackService; private PlaybackService playbackService;
private final Object waitForService = new Object(); private final Object waitForService = new Object();
private static final int JOB_ID = -17001;
public static void updateWidget(Context context) { 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 @Override