Through the “Application Will Deactivate Delegate” I’m able to start a media player when the app is being put into the background, by pressing the home button or similar, and I can start an audio track.
It should also keep on running when the screen is locked to save energy while using the application. When locking the Screen (Pressing the lock Button on the side of the device) the “Application Will Deactivate Delegate” is being called successfully but the audio does not start.
In both cases the PLAY function return this Warning:
LogAndroidMedia: Warning: Cannot set rate while closed, preparing, or in error state
And the result boolean is false too.
Is there a way to get this to work when a screen is locked? Or did I stumble accross a bugg and it isn’t even supposed to be able to play a sound when it is in the background?
Any information about how playing audio with a locked device could work would be really appreciated!