How to to run a function in background even after the app is closed?

Thank you!

2 Likes

Thank you Anke and All who have participated in this good discussion.

Let’s conclude it when the new version is released by App Inventor.

2 Likes

No, unfortunately I get the same result as before when using the extension:
The sound stops after some time (approx. 60 seconds) when the device has switched to idle mode (screen off). Tested with the APK on Galaxy Note8 (Android 9).

What a pity, but it was worth a try.

1 Like

hello discussion is very good, but I ask in relation to the topic of the subject. Already and possible or not to have an extension in Kodular we can run a apk in the background even if already closed? if so what is the extension. Excuse me if I passed the answer and did not notice.

5 Likes

Note:

This issue (regarding Doze mode) with Samsung Note8, S8 etc. is reported in countless forums, see e.g. here:

There doesn’t seem to be a solution to this and Samsung simply ignores the problem. Strange.

Therefore, this seems not to be a problem related to your great extension @Atom_Developer .

It seems you need to have a running foreground service.
https://exoplayer.dev/troubleshooting.html#how-do-i-keep-audio-playing-when-my-app-is-backgrounded

1 Like

I have already added that feature to my extension (beta)(not-released)
And it’s and fantastic feature,I have also sent you demo apk in DM,check it​:grinning_face_with_smiling_eyes:

4 Likes

Yes, I checked it and really works.
I had no hope anymore to get a solution to this problem. Amazing job!

But unfortunately it is not so easy to cope with these BackgroundTask blocks. It seems to me that I have to start from scratch again. :wink:

3 Likes

Thanks a lot!

2 Likes