When the phone is fast asleep, and a scheduled service is started, how long is the service allowed to run before it is killed by the OS.
Is it good practice to use 'service.startforeground' in a scheduled 'service_create' to keep it alive ?
Reason I am asking I have a few services that are scheduled and one of the is for GPS positioning, and another is for Bluetooth serial comms, the two are not linked in any way.
service.startforeground will keep it alive but with a Icon at the top of the screen, even though that's simple enough to hide. Have you tried running the service as Sticky Service and using StartServiceAt(Null, xxx, True) in the service itself?
service.startforeground will keep it alive but with a Icon at the top of the screen, even though that's simple enough to hide. Have you tried running the service as Sticky Service and using StartServiceAt(Null, xxx, True) in the service itself?
This solution works perfectly fine for me...
The icon display is fine. Service is Stickyand yes I do use StartServiceAt("", xxx, True) not StartServiceAt(Null, xxx, True). So it is best practice to use service.startforeground ?
Mmmm... after some time working on this today, I have noticed that sometime my service will pause for maybe 1-2 mins before resuming, is hooking a service to the notification object dependent on the time that is allocated to the notification object by the OS. I have reverted back to using a partial lock to do some further tests. I suspect the former is true..(as far as I can see anyways)...maybe Lord @Erel can verify this.