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...
This commit is contained in:
Martin Fietz 2018-09-06 16:47:17 +02:00
parent 9512c0133f
commit 7cf75c7cac
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.
*/
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

View File

@ -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