Can a third party application get an action once the device goes in to Doze mode?
Trying to register Broadcast receiver for below action,
To confirm what was mentioned in the comments, defining the android.os.action.DEVICE_IDLE_MODE_CHANGED
broadcast receiver via the AndroidManifest.xml has no effect.
The only way to register the receiver is to do it dynamically:
IntentFilter filter = new IntentFilter();
filter.addAction(PowerManager.ACTION_DEVICE_IDLE_MODE_CHANGED);
context.registerReceiver(new BroadcastReceiver()
{
@Override
public void onReceive(Context context, Intent intent)
{
onDeviceIdleChanged();
}
}, filter);