I\'m using Android app widgets. I\'m creating a PendingIntent
object and use it in the method RemoteViews#setOnClickPendingIntent()
. This is the pe
As you note, an app widget does not count for the PendingIntent
background whitelist. I do not know why — it would seem to be about on par with a PendingIntent
started by a Notification
. Perhaps it's an issue that the Notification
is a system thing, whereas the app widget is a home screen thing. Regardless, you could:
Use getForegroundService()
, as you have, or
Try getBroadcast()
with an explicit Intent
, and with the BroadcastReceiver
starting a JobIntentService
, if you do not want to raise a Notification
(as a foreground service requires)
Based on your symptoms, you appear to have tripped over what I would consider to be a bug: there should be a way to switch from getService()
to getForegroundService()
without having to reboot. :-) I'll try to run some experiments and will file an issue if I can reproduce the problem.