I am starting an IntentService several times with a unique id value. When I recreate the intent and use it to call stopService on the current IntentService, the entire IntentService queue is cancelled on top of stopping the current IntentService. Also, calling stopService on an IntentService that is in the queue, has no effect.
Start Service:
Intent intent = new Intent(context, IntentService.class);
intent.putExtra("action", "scan");
intent.putExtra("id", id);
context.startService(intent);
Stop Service
Intent intent = new Intent(context, IntentService.class);
intent.putExtra("action", "scan");
intent.putExtra("id", id);
context.stopService(intent);
I would like the IntentService with the associated id to be stopped / removed from queue, then have the rest of the queue run its course.
I think you may have to implement your own type of intent service here. Looking at the code
Although looking at the
stopSelf(int)method, you might be able to do this manually if you know what each intent is created with.So something like:
I haven’t tried this but might be a nudge in the right direction. Although I think that it might not do anything as it will only stop running services.
Otherwise you will have to make your own IntentService where you can fire remove intents at it.. might be worth nudging @commonsguy
Cheers,
Chris