Android Question StartServiceAtExact doesn't start at the exact time.

tonymonaghan

Member
Licensed User
Longtime User
I have an alarm clock project which uses StartServiceAtExact to start my alarm service but sometimes the service is delayed by 2 or 3 minutes. It doesn't happen every time and seems to occur more often if the phone has been used a lot prior to the alarm. It's a Samsung Galaxy S2 phone running Cyanogenmod 5.1.
Thanks.
 

Erel

B4X founder
Staff member
Licensed User
Longtime User
How do you see that the service is delayed? Are you monitoring the logs?

Try to acquire a wake lock immediately when the service is started (and release it when it is no longer needed).

Another thing you can do is to wake the phone a few minutes earlier and use a standard timer together with a foreground service and a wake lock to make sure that it "rings" at the exact time.
 
Upvote 0
Top