Make app run after mobile goes to sleep mode

Hi, im trying to make countdown clock run even after the phone goes to sleep mode by this method but its not working (trying to play a sound in a loop). The countdown stops.


I'll be happy for help.

See the example here

Taifun

  1. You must use a Foreground service on devices with Android 6+ (to prevent Doze mode). See e.g. here: Ullis Roboter Seite/AI2 Keep Alive

  2. The Android Player component (MediaPlayer) cannot loop sounds seamlessly (without small gaps). You must use the TaifunPlayer or another appropriate Player extension.

Thanks ill try it

... and you must use .ogg or .wav audio format for gapless looping.

And then its enough to put a block for running a player in a loop or do i need other things like using foreground service to solve the problem?

→ post #3.