You shouldn't use ServiceStartAt as a timer. You should instead use a real timer.
@lemonisdead I personally use StartServiceAt set to True and as a Sticky Service in all my widgets and services. I use StartServiceAt as a timer (Mainly set to every 60 seconds or 60 minutes (for my weather app)) as I find that using an actual timer is not reliable enough for me, especially for my clock app/widget.
Resources wise I've just check settings - battery usage on 4 devices running my widgets and services and not one of my widgets or services are showing up in the standard Android battery usage list lowest is 1%.
I will use a timer within StartServiceAt if what I'm doing with the timer falls within 60 seconds of the StartServiceAt starting...
Hello @Peter Simpson,
Thanks for your reply and the example you provided. I think that this example is not too much energy consuming because the widgets are handled by the system.
But what about another example : you have to check some information twice a hour.
Option 1 :
- create a sticky service including the timer
- modify the PhoneWakeState to KeepPartialLock
- create a service in charge of starting a second service which will collect the information
- use StartServiceAt with During Sleep at True so you don't have to worry about the wake state