索尼的SmartWatch - 在智能手表调用应用程序时,它得到一个事件 [英] Sony SmartWatch - invoke app on Smart Watch when it gets an event

查看:233
本文介绍了索尼的SmartWatch - 在智能手表调用应用程序时,它得到一个事件的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想编写一个监视接收到的SMS的应用程序,并通知我的手表,如果短信的内容包含了predefined文本(例如,回家)。

I'd like to write an app that monitors incoming SMS and notify me on the watch if the content of SMS contains a predefined text (e.g. "go home").

我知道我可以使用通知API添加事件。它会震动,并显示在手表的小应用程序图标。如果我想使用的控制API来LED闪光灯,并显示在当它接收到短信手表整个文本和图像,我应该怎么办?

I know I can use the notification API to add an event. It will vibrate and show a small app icon on the watch. What if I want to use control API to flash LED and show the whole text and an image on the watch when it receives the SMS, how should I do?

这是非常相似的呼叫处理附加。索尼能否打开的呼叫处理的来源,以供参考?

It's very similar to the "Call handling" add-on. Can Sony open the source of "Call handling" for reference?

推荐答案

我觉得你有两个选择。无论是如你所说,1)实现使用这两个通知API和控制API的扩展。或2)刚刚实施控制扩展。

I think you have two options. Either, as you say, 1) implement an extension that uses both the notification API and the control API. Or 2) just implement a control extension.

有关1),可以添加启动使用下面的START_REQUEST意图控件扩展自定义操作。请参见SampleNotificationExtension code中的doAction1方法。这意味着,一个标准的通知将在手表上显示,那么你就能present自定义视图给用户,如果用户点击自定义操作按钮。

For 1), you could add a custom action that starts your control extension using the START_REQUEST intent below. See the doAction1 method in the SampleNotificationExtension code. This would mean that a standard notification will be shown on the watch, then you will be able to present a custom view to the user, if the user clicks the custom action button.

和2),完全实现你的功能控制扩展并要求它,当你由你滤镜的短信开始。缺点是,你需要present的SMS文本自己,而这情况下,1)是由你的框架做了。

And for 2), implement your functionality completely as a control extension and request for it to be started when you get the SMSs that is found by your filter. Drawback is that you need to present the SMS text yourself, which in case 1) is done by the framework for you.

START_REQUEST意图例如:

START_REQUEST-intent example:

Intent intent = new Intent(Control.Intents.CONTROL_START_REQUEST_INTENT);
intent.putExtra(Control.Intents.EXTRA_AEA_PACKAGE_NAME, "your.package.name");
intent.setPackage(hostAppPackageName);
sendBroadcast(intent, Registration.HOSTAPP_PERMISSION);

这篇关于索尼的SmartWatch - 在智能手表调用应用程序时,它得到一个事件的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆