【问题标题】:how to show a screen if sony smartwatch is locked如果索尼智能手表被锁定,如何显示屏幕
【发布时间】:2014-09-22 17:15:57
【问题描述】:
当屏幕被锁定时,如何在索尼智能手表 2 中显示屏幕,就像我们对通话应用程序所做的那样。即使我们接到电话时屏幕被锁定,它也会预先显示。当我的应用程序通过控制 api 打开时,我可以显示这一点。但是当我的应用程序没有打开并且我的移动应用程序中发生了一些事件时,我也必须在智能手表中显示相同的内容。我认为我们可以通过隧道服务做到这一点,但我不知道怎么做。请帮忙
【问题讨论】:
标签:
android
sony
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 是调用的设备主机应用程序的名称,在本例中为 SmartWatch2:"com.sonymobile.smartconnect.smartwatch2"
此命令将启动并显示在您的应用程序中注册的ControlExtension。