Android Question startserviceat when user closes app

Startup

Active Member
Licensed User
Longtime User
How do I have my app's StartServiceAt still work (ie: start a service at a set time) even when user has closed the app. I have an alarm clock (not mine .. from the play store) which does that (ie: rings even although I've closed the app) but I can't figure how to do that?
 

DonManfred

Expert
Licensed User
Longtime User
Upload a small project where it is not working.
I don´t see a reason why it should not work at all.
Only keep in mind that you´ll not able to restart your app every 5 minutes.... The time between should be 30 minutes+
Also note that you should NOT use the starter service for this. Use another service for this.
 
Upvote 0

Startup

Active Member
Licensed User
Longtime User
Upload a small project where it is not working.
I don´t see a reason why it should not work at all.
Only keep in mind that you´ll not able to restart your app every 5 minutes.... The time between should be 30 minutes+
Also note that you should NOT use the starter service for this. Use another service for this.

Attached is zip. App runs and rings alarm in 10 seconds and displays button. Press the button and alarm rings 10 seconds later. However if app is closed in the meantime alarm doesn't ring.
Thanks DonManfred!
 

Attachments

  • TestStart1.zip
    238.9 KB · Views: 213
Upvote 0

DonManfred

Expert
Licensed User
Longtime User
. App runs and rings alarm in 10 seconds and displays button. Press the button and alarm rings 10 seconds later. However if app is closed in the meantime alarm doesn't ring.
as i wrote. You probably need to use a interval of 30 minutes+ otherwise android will not start your service.
Except when you start a foreground service for this 10 seconds.
 
Upvote 0

Startup

Active Member
Licensed User
Longtime User
as i wrote. You probably need to use a interval of 30 minutes+ otherwise android will not start your service.
Except when you start a foreground service for this 10 seconds.

I think the problem is that I was running it in Debug mode. It seems to work ok in release mode.
Thanks!
 
Upvote 0
Top