Tap on SmartWatch screen in code

末鹿安然 提交于 2019-12-12 01:33:11

问题


When I touch the SmartWatch screen it wakes up from dimmed state. How can I in code do the same thing?


回答1:


Refer to section 6.2 of the "SmartExtension API Specification" document that comes with the SmartExtension SDK:

Extensions implementing the Control API also have the possibility to control the state of the accessory display. The display can be controlled via the CONTROL_SET_SCREEN_STATE_INTENT.

As part of the Intent, you also need to specify what state you want to set. The following options are available:
* SCREEN_STATE_OFF
* SCREEN_STATE_DIM
* SCREEN_STATE_ON
* SCREEN_STATE_AUTO




回答2:


What Michael says is correct, and is also said in this thread (as you know :). When you set the screen state to AUTO, the screen state will be handled by the SmartWatch itself. In this state, when the screen has been completely dimmed, you will not get touch events to your extension. Instead you will get a call to onResume.

So, to achieve what you want, I think you need to create a state machine that handles the states ON, OFF and DIM, and leave AUTO out of it.



来源:https://stackoverflow.com/questions/14543624/tap-on-smartwatch-screen-in-code

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!