OnePlus Watch 2 force stop my application when screen turns of and it cancels all scheduled alarms

79 Views Asked by At

I have a Wear OS application which is working fine since the original Android Wear; even on Wear OS 4 Samsung watches. Problem is on the new OnePlus Watch 2, which is a Wear OS 4 device, but with some bigger changes to improve battery (which is awesome :))

Once I close the app's Activity and the watch turns its screen of, it force stops my application with logs in the LogCat:

ActivityManager system_server Force stopping <my package name> ....
ActivityManager system_server Killing 31668: <my package name> ....
CarrierSvcBindHelper com.android.phone onHandleForceStop: [<my package name>]
ActivityManager system_server Got obituary of 31668:<my package name>

And after that all my scheduled alarms, scheduled via setExactAndAllowWhileIdle() and setAlarmClock() are removed from the pending alarms -- checked via adb shell dumpsys alarm which doesn't show my alarms anymore.

If I just minimize the Activity, then the alarms stay scheduled and evertyhing works as expected (confirmed with adb shell dumpsys alarm). Is this some new behaviour in Wear OS 4/Android 13 or a bug in OnePlus Watch 2? How can I reliably schedule alarms on this watch?

0

There are 0 best solutions below