简体   繁体   English

如何在受信任的 Web 活动中保持屏幕唤醒?

[英]How to keep the screen awake in Trusted Web Activity?

I need help regarding Trusted Web Activity.我需要有关可信 Web 活动的帮助。 My app works fine, but I need to add a function that keeps the screen awake without user interaction.我的应用程序运行良好,但我需要添加一个功能,无需用户交互即可使屏幕保持唤醒状态。

I am converting my website into a mobile application using Trusted Web Activity through Android Studio, but how can I keep the Trusted Web Activity screen awake while the user is using app but not interacting.我正在通过 Android Studio 使用受信任的 Web 活动将我的网站转换为移动应用程序,但是如何在用户使用应用程序但未进行交互时保持受信任的 Web 活动屏幕处于唤醒状态。 Trusted Web Activity is not using an Android Activity and XML layouts, so it's not possible to use the Android Wake Lock API . Trusted Web Activity 未使用 Android Activity 和 XML 布局,因此无法使用Android Wake Lock API How can I implement in the Trusted Web Activity or the web application?如何在 Trusted Web Activity 或 Web 应用程序中实现?

The Trusted Web Activity is like a browser tab without UI. Trusted Web Activity 就像一个没有 UI 的浏览器选项卡。 The same web APIs that work in the browser should also work when running in the Trusted Web Activity mode.在受信任的 Web 活动模式下运行时,在浏览器中工作的相同 Web API 也应该工作。

Having said that, web Wake Lock API , available web applications, can be used prevent the screen from turning off on the web app.话虽如此,Web Wake Lock API是可用的 Web 应用程序,可用于防止屏幕在 Web 应用程序上关闭。 The linked article provides instructions on how to use it.链接的文章提供了有关如何使用它的说明。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM