> Yes, even Samsung - a dominant vendor in the Android market - is using nasty battery saving technique which may kill background processes and render alarm clocks useless. See below for workarounds.
Wait, do you really need a background task for alarms?
(why) isn't there a system-level service to notify and wake up your app at a pre-defined time or interval?
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.
On 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.
No, 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.
>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).
what 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.
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.
The whole damn page you're commenting on exists because those APIs are broken by OEMs. You schedule execution, the alarm doesn't trigger. Did you look at the page before commenting? :(
My Galaxy S6 was really aggressive for closing apps that it thought might impact battery life. Specifically, it was always closing one app I used to record my workouts in the gym. Very annoying.
> Yes, even Samsung - a dominant vendor in the Android market - is using nasty battery saving technique which may kill background processes and render alarm clocks useless. See below for workarounds.
Wait, do you really need a background task for alarms?
(why) isn't there a system-level service to notify and wake up your app at a pre-defined time or interval?