简体   繁体   English

控制应用程序Sony Smartwatch2

[英]Control App Sony Smartwatch2

Hello I am developing an app for the Sony Smartwatch 2 and I have a couple of questions: 您好,我正在为Sony Smartwatch 2开发应用程序,但有两个问题:

First: is it possible to Launch the "app on the watch" using the app on my phone? 第一:可以使用手机上的应用启动“手表上的应用”吗? I mean I want to be able to click a button on the phone which will automatically launch the app on the watch. 我的意思是我希望能够单击手机上的按钮,这将在手表上自动启动该应用程序。

And my second question is: how do I send data from the phone to the watch, for example, I have a Serie of layouts and according to what the user clicks on the phone it will Show a different layout on my watch. 我的第二个问题是:如何将数据从手机发送到手表,例如,我有一系列的布局,并且根据用户在手机上单击的内容,它将在手表上显示不同的布局。

Thank you very much. 非常感谢你。

If you want to start the SmartWatch 2 you can do it using this code: 如果要启动SmartWatch 2,可以使用以下代码进行操作:

         Intent i1 = new Intent("com.sonyericsson.extras.aef.control.START_REQUEST");
         i1.putExtra("aea_package_name", "com.youpackage.name");
         i1.setPackage("com.sonymobile.smartconnect.smartwatch2");
         ctxt.sendBroadcast(i1, "com.sonyericsson.extras.liveware.aef.HOSTAPP_PERMISSION");

For the SmartWatch 2 all of the code runs on the phone not the watch, so if you want to share data between the phone and watch you can use regular android methods. 对于SmartWatch 2,所有代码都在手机而非手表上运行,因此,如果您希望在手机和手表之间共享数据,则可以使用常规的android方法。 If you need real time communication you can always use a broadcast reciever. 如果您需要实时通信,则可以随时使用广播接收器。 Follow this link for instructions on how to setup a broadcast receiver and download the sample so you can get a better idea of how it works 按照此链接获取有关如何设置广播接收器和下载示例的说明,以便您可以更好地了解其工作原理

https://developer.android.com/training/run-background-service/report-status.html https://developer.android.com/training/run-background-service/report-status.html

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM