Is there any way to run a simple command on screen turned off for more than 2 or 3 minutes?

Hi, I’m making an amazing online music player, but i need to reproduce the next song when the first one is finished, all this need to happen while the phone screen is locked.


This is the procedure I want to execute, I’ve been trying some extensions like Idle Mode from @bodymindpower and it does not work when the screen is turned off more than 1 minute…

Try to use Background Task extension, maybe this extension can help you to do that

Can you help me seeing how can I call the procedure shown in the image with the Background Task extension?

The problems with streaming / radio apps have been discussed intensively and extensively in all forums (AI2, Kodular, …) for years (also with the MIT and Kodular staff). Search the appropriate forums. I made a final statement on this and presented the solution, after testing this on dozens of devices and all Android versions from KitKat onwards.

So search the forum (and the corresponding other forums) and you will find what you are looking for.

A Background Task has nothing to do with that. It has no effect on Doze mode.

1 Like

That was the keyword I was looking for :grin:… I’ve been doing “some” research :roll_eyes:


But I finally found your post Keep Alive Extension I dont know how much I’m grateful for you.

I just start the KeepAlive extension when the user turns off the screen, and stop the extension when user turn back on the phone screen so the notification isn’t visible for the user. If there’s a better way to do it, please let me know. :wink:

Also stay tuned for the music app I’m doing :fire: :fire: here’s some screenshots :zipper_mouth_face:

I don’t get it. Please explain in more detail.

First I combined your Idle Mode extension to know when the phone screen is off, and the Keep Alive extension to create a foreground task so the Doze mode cannot be activated by the system.

2 Likes

Okay, so everything seems to be fine now.

1 Like

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.