Android Question Service stops when phone sleeps

jimseng

Active Member
Licensed User
Longtime User
Hello all.
I have an app that plays music from a server using mediaplayerstream.
I'm not sure why it stops when the phone locks. I am using B4A version 5.8 and I don't seem to be able to do service.startforeground, which I think is necessary. Although I can't be sure it isn't due to some power saving or perhaps the wifi connection sleeping. It used to work several android iterations ago. Does anybody have any ideas? (I have set wifi to stay on when the phone sleeps).

Many thanks
 

jimseng

Active Member
Licensed User
Longtime User
I slightly mis-understood the service.startforeground. Do I need to put that in service_create or service_start. Struggling to find an example.
 
Upvote 0

conax

New Member
yes my app service stops when phone sleeps
Is there any sample running in the background? for check in every 30 seconds
 
Upvote 0

DonManfred

Expert
Licensed User
Longtime User
Is there any sample running in the background?
for check in every 30 seconds
Android will prevent you from doing it in such short interval. At least on never Android Devices.
 
Upvote 0
Top