如何显示在屏幕如果索尼智能手表被锁定 [英] how to show a screen if sony smartwatch is locked
问题描述
如何显示在索尼的SmartWatch 2的屏幕,当屏幕被锁定就像我们通过调用应用程序执行。即使当我们收到一个电话就说明前期屏幕被锁定。我能够显示这个时候我的应用程序是通过一个控制API开放。但是当我的应用程序不公开,在我的移动应用程序的一些事件发生,我必须展示智能手表一样好。我想我们可以用隧道服务,做到这一点,但我不知道怎么办。请帮助
How to show a screen in sony smartwatch 2 when screen is locked like we does with a call application. even if the screen is locked when we receive a call it shows upfront. I am able to show this when my app is open through a control api. but when my app is not open and some event happen in my mobile app i have to show the same in smart watch as well. I think we can do this with tunnel service but i dont know how. Pls help
推荐答案
要开始SmartWatch2一个ControlExtension,有一个 startRequest
命令,它可以用这种方式发送:
To start a ControlExtension on SmartWatch2, there is a startRequest
command, which can be sent this way:
protected void startRequest() {
Intent intent = new Intent(Control.Intents.CONTROL_START_REQUEST_INTENT);
sendToHostApp(intent);
}
其中,
protected void sendToHostApp(final Intent intent) {
ExtensionUtils.sendToHostApp(mContext, mHostAppPackageName, intent);
}
-
mContext
是您的活动或服务,从你在哪里发送命令上下文 -
mHostAppPackageName
是调用设备主机应用程序的名称,在这种情况下SmartWatch2:com.sonymobile.smartconnect.smartwatch2
mContext
is the Context of your activity or service, from where you are sending the commandmHostAppPackageName
is the name of the invoked device host application, in this case for SmartWatch2:"com.sonymobile.smartconnect.smartwatch2"
此命令将启动并显示 ControlExtension
,这是在您的应用程序注册。
This command will start and show the ControlExtension
, which is registered in your application.
这篇关于如何显示在屏幕如果索尼智能手表被锁定的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!