弃用 SCREEN_BRIGHT_WAKE_LOCK 后,如何在 Wear OS 中保持屏幕打开?
对于我的 Wear OS 表盘项目,我使用标志 SCREEN_BRIGHT_WAKE_LOCK 来获取唤醒锁,使屏幕完全打开一分钟(由用户根据需要触发)。该标志已被弃用。标志 PARTIAL_WAKE_LOCK 仍然有效,但不会保持屏幕打开。现在这样做的正确方法是什么?
For my Wear OS watch face project, I was using the flag SCREEN_BRIGHT_WAKE_LOCK to acquire a wakelock that keeps the screen fully on for one minute (triggered by the user as needed). This flag has been deprecated. The flag PARTIAL_WAKE_LOCK is still valid, but does not keep the screen on. What is the correct way to do this now?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
我相信手表可以控制这一点,并且通常是用户设置来启用“始终显示”。即使在这种模式下,应用程序也可能在环境模式下运行。
对于表盘,您可以检查drawMode
https://github.com/android/wear-os-samples/blob/main/WatchFaceKotlin/app/src/main/java/com/example/android/wearable/alpha/AnalogWatchCanvasRenderer.kt#L221-L226
对于
应用程序
AlwaysOnKotlin 示例演示如何支持您的应用在环境模式下绘图
它使用 环境模式
I believe the watch controls this and it's usually a user setting to enable "Always on Display". Even in this mode, it's likely that the app also runs in ambient mode.
For Watchfaces, you can check the drawMode
https://github.com/android/wear-os-samples/blob/main/WatchFaceKotlin/app/src/main/java/com/example/android/wearable/alpha/AnalogWatchCanvasRenderer.kt#L221-L226
When it
For Apps
This AlwaysOnKotlin sample demonstrates how to support your app drawing in Ambient mode
It uses Ambient Mode