4 ms·
No, you don't need a background task for alarms. There is a JobScheduler API for that. The aggressive battery settings of most vendors only interfere with badl
by seszett 8y ago
No, you don't need a background task for alarms. There is a JobScheduler API for that.
The aggressive battery settings of most vendors only interfere with badly coded apps to begin with, apps that use background tasks when they should be using more appropriate APIs.
- kkarakk 8y agowhat the jobscheduler api is supposed to be used for isn't clear in the docs so people tend to default to creating services(the old way of doing background activities) instead.
- jdietrich 8y agoThe API docs seem perfectly clear to me. https://developer.android.com/topic/performance/scheduling https://developer.android.com/topic/performance/scheduling
- kkarakk 8y agohttps://docs.microsoft.com/en-us/xamarin/android/platform/android-job-scheduler https://docs.microsoft.com/en-us/xamarin/android/platform/an... compare microsoft's documentation of the same thing with google's documentation and you will see where the failing happens. in comparison intentservices(the old way of doing bg tasks recommended by everyone) are documented the same way by both google and microsoft and so that gets used instead.
- CannisterFlux 8y agoOn some Xiaomi devices the stock alarm clock - the Google one - regularly fails to trigger alarms. If Google themselves cannot code an Android alarm clock that works with these aggressive battery saving anti-features there's little hope for anyone else.
- hiddentruth 8y agoAre you referring to Xiaomi devices that are running stock android (part of Android One program)?
- CannisterFlux 8y agoNo, I have an A1 and it doesn't have these problems. Note 5 definitely did the random alarm fail thing. The Note 5 kills other apps too like step counter or calendar event notifications. Maybe those apps are "badly coded" or whatever, but on a Moto G that sort of shenanigans didn't happen and the same apps worked great with no terrible battery life.
- romwell 8y ago>apps that use background tasks when they should be using more appropriate APIs. But some tasks do need to run in background, don't they? Specifically, sports tracking apps. Had a lot of issues with those on on various phones; now I simply don't switch out of the tracking app at all while it's running (otherwise, I can never be sure it simply won't be tombstoned in the background).