There are a couple of things you can try which, when used in concert, should be able to cut through all of the idle/standby/doze modes (irrespective of OS version).
1. Use a WakefulBroadcastReceiver
instead of an ordinary BroadcastReceiver
. Make sure you include the WAKE_LOCK
permission to use it correctly.
2. Use the setExactAndAllowWhileIdle()
method (on API 23 & above) to schedule the Intent
for the receiver:
if(Build.VERSION.SDK_INT < 23){
if(Build.VERSION.SDK_INT >= 19){
setExact(...);
}
else{
set(...);
}
}
else{
setExactAndAllowWhileIdle(...);
}
References:
1. Alarm manager for background services.
2. A flowchart for background work, alarms, and your Android app.