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
可以将文章内容翻译成中文,广告屏蔽插件可能会导致该功能失效(如失效,请关闭广告屏蔽插件后再试):
问题:
回答1:
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);
}
where
protected void sendToHostApp(final Intent intent) {
ExtensionUtils.sendToHostApp(mContext, mHostAppPackageName, intent);
}
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"
This command will start and show the ControlExtension
, which is registered in your application.