I am building a clock radio app which, on my device, running Android 7.1.1 stops playing after a few minutes (2.5 - 4 roughly) when the user presses the powerbutton to switch off the display.
This is due to the device entering doze mode, I believe. My Activity holds wifi- and wake locks to play the radio stream even when screen off.
I read the Info page about the doze mode and found a chapter about the whitelisting of "allowed usecases" like voip apps and so on.
The page states that: "Note: Google Play policies prohibit apps from requesting direct exemption from Power Management features in Android 6.0+ (Doze and App Standby) unless the core function of the app is adversely affected."
Since they do not have any "Media playing app" in their examples, I am not sure if it would be allowed to ask the user actively (via intent) to add my clock radio app to their whitelist.
Of course I do not want Google to remove my app from Play Store, so - can any one tell me for sure whether or not it is a suitable usecase for whitelisting?
I mean - of course my core function (playing a radio stream) is adversely affected when doze mode ignores the wake locks and the app stops playing. So I believe it has to be allowed in this case to ask for the permission?
(The idea of this function is, allowing the users to get up and do their morning stuff while still listening to the "alarm"-stream until they are done and cancel the alarm manually - but during that time they surely want to switch off the display..)
Any (proven correct) information would be greatly appreciated.
In this case, as discussed on the Doze training documentation you should have a foreground service with a notification for media playing.