即使前台服务和后台服务处于关闭状态,传感器数据也会在屏幕关闭时暂停。 Android Wear 中使用了部分唤醒锁
随着 Android Wear 3.2 操作系统更新,屏幕关闭时加速计传感器数据会暂停。
- 我已经使用了前台服务并在清单中声明了其权限。
- 我还使用了部分唤醒锁并在清单中声明了其许可。
直到 Android Wear OS 3.0,传感器数据在所有情况下都会持续出现,包括屏幕关闭。
但是将 Wear OS 更新到 3.2 后,它就崩溃了,并且只能在屏幕打开时才能工作。 我还观察到以下日志: A) 当屏幕关闭时: PARTIAL_WAKE_LOCK 'MyApp::Monitoring' DISABLED 已禁用 -> true
B) 当屏幕打开时,传感器数据通过: PARTIAL_WAKE_LOCK 'MyApp::Monitoring' DISABLED 已禁用 -> false
请提出解决方案。
我已经检查了 传感器文档 并据此,前台服务应该足以获取连续的数据。
With Android Wear 3.2 OS update, the Accelerometer Sensor Data gets paused when the Screen goes off.
- I have used Foreground Service and declared its permission in the manifest.
<uses-permission android:name="android.permission.FOREGROUND_SERVICE"/>
- 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.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
我的一个同事发现了似乎有效的东西,在连接到手表的智能手机上打开“磨损”应用程序并激活了这一点:
观看设置&GT;应用&gt;您的应用程序&gt;允许背景活动
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
Wakelock的工作不工作是一个错误,并且已由Google修复。这是问题跟踪器: https://issuetracker.google.google.com/issues/issues/228086086
WakeLock's not working was a bug, and has been fixed by Google. Here was the issue tracker: https://issuetracker.google.com/issues/228086086