Android Question What can prevent services from starting at specified time ?

JTmartins

Active Member
Licensed User
Longtime User
I have a few services in an app. Some are scheduled to startAT 2 minutes later after being destroyed, others one minute..However they start whenever they want, sometimes taking up to 20 minutes. They always start after a while, but it seems random.

StartServiceAtExact also does not seems to make any difference.

Just know, one that is schedulled to start every 45 seconds...started after 19 minutes an 12 seconds and then started again 12 minutes later.

This is in release mode, with cable connected from the device to the PC, and I can check the logs of when they start, when destroyed.

What kind of things can cause can cause this behaviour ?
 
Last edited:

JTmartins

Active Member
Licensed User
Longtime User
Nope its an Android 5.1 device.

In the mean time I solved the problem, using timers to start the services..and they work ok...But startserviceat, its giving me unpredictable results.
 
Upvote 0

wes58

Active Member
Licensed User
Longtime User
Nope its an Android 5.1 device.

In the mean time I solved the problem, using timers to start the services..and they work ok...But startserviceat, its giving me unpredictable results.
If you are using android 5.1 than of course that startserviceat is not accurate. If you searched the forum you would find out this: https://www.b4x.com/android/forum/t...tion-for-targetsdkversion-19-and-above.53934/.

StartServiceAtExact is working fine (I have been using it since may last year), unless you are doing something else wrong.
 
Upvote 0

JTmartins

Active Member
Licensed User
Longtime User
Well StartServiceAtExact gives me the same results , it is not working OK here. It works with one service...But does not work with several services that need to be fired in a quite big project. I will dig into this with a little more time to see if I can understand what is causing the problem.
 
Upvote 0
Top