Sensor Data pauses upon Screen OFF even when Foreground Service & Partial Wake Lock are used in Android Wear

716 views Asked by At

With Android Wear 3.2 OS update, the Accelerometer Sensor Data gets paused when the Screen goes off.

  1. I have used Foreground Service and declared its permission in the manifest.

<uses-permission android:name="android.permission.FOREGROUND_SERVICE"/>

  1. I have also used Partial Wake Lock and declared its permission in the manifest.

<uses-permission android:name="android.permission.WAKE_LOCK"/>

Until Android Wear OS 3.0, Sensor data was coming up continuously in all cases including Screen Off.

But after updating Wear OS to 3.2, it broke and it works only when the screen is ON. I also observed below logs: A) When Screen goes OFF: PARTIAL_WAKE_LOCK 'MyApp::Monitoring' DISABLED disabled -> true

B) When Screen goes ON, sensor data comes through: PARTIAL_WAKE_LOCK 'MyApp::Monitoring' DISABLED disabled -> false

Please suggest the solution.

I have checked Sensor documentation and as per that, Foreground Service should be enough to get continuous data.

2

There are 2 answers

0
Luke B. On

A coworker of mine found something that seems to work, open the 'Wear' app on the smartphone connected to the watch and activate this: Watch settings > Apps > your app > Allow background activity

0
WiscoApps On

WakeLock's not working was a bug, and has been fixed by Google. Here was the issue tracker: https://issuetracker.google.com/issues/228086086