Tap on SmartWatch screen in code

2019-09-07 16:13发布

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

2条回答
我只想做你的唯一
2楼-- · 2019-09-07 16:30

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

查看更多
男人必须洒脱
3楼-- · 2019-09-07 16:32

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.

查看更多
登录 后发表回答