即使前台服务和后台服务处于关闭状态,传感器数据也会在屏幕关闭时暂停。 Android Wear 中使用了部分唤醒锁

发布于 2025-01-17 12:59:42 字数 925 浏览 1 评论 0原文

随着 Android Wear 3.2 操作系统更新,屏幕关闭时加速计传感器数据会暂停

  1. 我已经使用了前台服务并在清单中声明了其权限。

>;

  1. 我还使用了部分唤醒锁并在清单中声明了其许可。

>

直到 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.

  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.

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(2

红尘作伴 2025-01-24 12:59:42

我的一个同事发现了似乎有效的东西,在连接到手表的智能手机上打开“磨损”应用程序并激活了这一点:
观看设置&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

辞慾 2025-01-24 12:59:42

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

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文