Android Question How do I determine if a service is running?

davepamn

Active Member
Licensed User
Longtime User
I have a service that occasionally stops. I need a way to detect the service is stop and restart it.
 

walterf25

Expert
Licensed User
Longtime User
I have a service that occasionally stops. I need a way to detect the service is stop and restart it.
Have you tried
B4X:
If IsPaused("ServiceName") then

end if

Normally to prevent the OS from killing your service you need to make the service run as a StickyService, do a search for this keyword and you'll find all the information you need.

Hope this helps!
Walter
 
Upvote 0

davepamn

Active Member
Licensed User
Longtime User
B4X:
if ispaused(UpdateServer) then
stopservice(UpdateServer)
startservice(UpdateServer)
end if
 
Upvote 0
Top