简体   繁体   English

事件发生后如何打开可穿戴式Web应用的屏幕

[英]How to turn screen of a tizen wearable web app on after some event

I'm developing a tizen wearable web app. 我正在开发一个简单的可穿戴网络应用程序。 I'm using tizen 3.0. 我正在使用tizen 3.0。 My app can do work in the background. 我的应用程序可以在后台运行。 (At least it should be able) (至少应该能够)

When something happens within my app when screen is off, I want to turn it back on again and show a popup (just as an example) 当屏幕关闭时,我的应用程序中发生某些事情时,我想再次将其重新打开并显示一个弹出窗口(仅作为示例)

Apparently tizen.power.turnScreenOn() is deprecated since 3.0 and will be removed in the next release. 显然tizen.power.turnScreenOn()从3.0开始已被弃用,并将在下一个版本中删除。

tizen-sdk told me to use tizen.power.request("SCREEN", "SCREEN_NORMAL") . tizen-sdk告诉我使用tizen.power.request(“ SCREEN”,“ SCREEN_NORMAL”) But this does not turn my screen on. 但这并不能打开我的屏幕。 As far as I understand the API documentation this just tells to leave the screen on (until it is released) 据我了解的API文档,这只是告诉屏幕保持打开状态(直到发布)

So what I currently have: 所以我现在有:

function bringApplicationToFront() {
  //here I would use tizen.power.turnScreenOn():
  tizen.power.request("SCREEN", "SCREEN_NORMAL");
  var app = tizen.application.getCurrentApplication();

  //app is launched just in case it is currently in background
  tizen.application.launch(app.appInfo.id, () => {
    tau.openPopup("pageToShow");
    tizen.power.release("SCREEN");
  }
}

background support is enabled in config.xml: 在config.xml中启用了后台支持:

<tizen:setting background-support="enable" encryption="disable" hwkey-event="enable"/>

So question is: Is there a way to turn the screen on once an event occured in my app? 所以问题是:一旦我的应用程序发生事件,是否有办法打开屏幕?

maybe if you put this line in your config.xml file 也许如果您将此行放在config.xml文件中

<tizen:setting background-support="enable" encryption="disable" hwkey-event="enable"/>

In my project only work with this line. 在我的项目中,仅使用此行。 This is for web service run in background too, so you can run everything. 这也是用于在后台运行的Web服务,因此您可以运行所有内容。

As I know... For regular web UI application, background operation is NOT guaranteed. 据我所知...对于常规的Web UI应用程序,不能保证后台操作。 Especially furthermore in commercial target for battery consumption issue. 特别是在电池消耗问题的商业目标中。

I use native service application (for Hybrid app) and app control to launch or wake up web UI application. 我使用本机服务应用程序(用于混合应用程序)和应用程序控件来启动或唤醒Web UI应用程序。

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

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