2014-09-20 207 views
0

如何在屏幕锁定时显示sony smartwatch 2中的屏幕,就像我们使用通话应用程序一样。即使屏幕在我们收到来电时被锁定,它也会显示在前面。我可以通过控件API在我的应用程序打开时显示此内容。但是当我的应用程序没有打开并且在我的移动应用程序中发生某些事件时,我必须在智能手表中显示相同的内容。我认为我们可以通过隧道服务来做到这一点,但我不知道如何。请帮助如何在sony smartwatch被锁定的情况下显示屏幕

回答

1

要开始SmartWatch2一个ControlExtension,有startRequest命令,它可以用这种方式来发送:

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是我的名字nvoked设备主机的应用程序,在这种情况下SmartWatch2:"com.sonymobile.smartconnect.smartwatch2"

此命令将启动并显示ControlExtension,这是在您的应用程序注册。

相关问题