The main goal is to get notified about the app getting updated and restart a service after app update.
Having a BroadcastReceiver and listening to Intent.ACTION_PACKAGE_REPLACED
to start my service when the app gets updated. And I get the following error
BroadcastQueue: Background execution not allowed: receiving Intent { act=android.intent.action.PACKAGE_REPLACED dat=package:com.volvocars.dj flg=0x4000010 (has extras) } to com.volvocars.drivingjournal/.core.service.KeepTheAppAliveReceiver
At the first glance, It seems like one of Background Execution Limits,
And I found that I could replace ACTION_PACKAGE_REPLACED
by ACTION_MY_PACKAGE_REPLACED
the result is that the error goes away but the BroadcastReceiver doesn't get any update event and it doesn't work. How can I fix this?