how to show a screen if sony smartwatch is locked

牧云@^-^@ 提交于 2019-12-11 16:23:51

问题


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 command
  • mHostAppPackageName 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.



来源:https://stackoverflow.com/questions/25945384/how-to-show-a-screen-if-sony-smartwatch-is-locked

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