Android on Chrome OS: AlarmManager/JobScheduler Broken
UPDATE 2016-07-19: AlarmManager
and JobScheduler
, which
previously did not work,
are now working. The exception is if the Chrome OS device is
asleep (e.g., lid closed) — in that case, alarms and jobs will
not fire. This includes any _WAKEUP
alarms.
If you get a Chrome OS device with Android support,
and you hack things to be able to test your app,
(even perhaps without adb
),
you can start seeing what works and what does not in your app.
In my preliminary testing, things worked fairly well, with one glaring
exception: AlarmManager
and JobScheduler
. You can set up all the
alarm events and jobs that you want. None will be run. You can have a
process still running, and the work will not be done. You can even
still be the foreground window, and the work still will not be done.
It is unclear if this is a bug, a temporary issue during the developer preview period, or an undocumented regression from Android norms. But I tried lots of different combinations (e.g., repeating and one-shot alarms) with no luck. Apps that work perfectly fine on a regular Android 6.0 device (e.g., a Nexus 5) just never have their periodic work done on Android-equipped Chrome OS.
Since we do not have official guidance for detecting whether we are on Chrome OS or not, we have no good way of letting the user know about this issue.
So long as you have a process running, in-process periodic work
(e.g., ScheduledExecutorService
) runs just fine.
With luck, not only will this get fixed, but perhaps we will be told officially how to file bug reports. I am rather confident that the Android issue tracker will punt on any Chrome OS-related issues, and the Chromium issue tracker is optimized for browser issues, not Chrome OS issues, let alone Android-on-Chrome OS issues.