我应该怎么做才能开始从计划code SmartWatch的扩展? [英] How should I do to start SmartWatch Extension from the program code?

查看:196
本文介绍了我应该怎么做才能开始从计划code SmartWatch的扩展?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想知道从程序code开始的SmartWatch扩展的方法。例如,意向等。   我注册了脚本语言的SmartWatch在谷歌播放的一天。   它分为两种方案,一种是注册为SmartWatch的扩展(BitmapCatcher),而另一个注册为智能手机应用程序(Luarida)。   该脚本开始从智能手机。在这里,我想开始BitmapCatcher同时作为起始的脚本。   的方式是不理解但它被认为是BitmapCatcher可以在没有触摸屏幕来启动如果Intnent发送到活件

I want to know the method of starting SmartWatch Extension from the program code. For instance, Intent etc. I registered the script language for SmartWatch in Google Play the other day. It divides into two programs, one is registered as SmartWatch Extension(BitmapCatcher), and another is registered as smart phone application (Luarida). The script starts from a smart phone. Here, I want to start BitmapCatcher at the same time as starting the script. The way is not understood though it is thought that BitmapCatcher can be started without the screen touch if Intnent is sent to LiveWare.

请教学中的SmartWatch扩展启动而不会在屏幕触摸程序code。

Please teach the program code in which SmartWatch Extension is started without the screen touch.

(有人建议向Jerker先生在这个网站的时候我写了一台索尼​​移动网站的智能额外的讨论这个问题。)

(It was recommended to ask Mr. Jerker on this site when I wrote this question in the Smart Extras discussion of a Sony mobile site.)

SmartWatch的扩展无法从其他Android应用程序开始虽然经过测试指的是你的解释。请重新教。
  我应该怎么写Your.package.name?
  此外,我应该怎么写HostAppPackageName?

  而其中,由sendBroadcast开始是BitmapCatcher。这个包的名字是com.luaridaworks.smartwatch.bitmapcatcher。
  在测试程序,它写了如下。它继续下面的注释。

SmartWatch Extension was not able to be started from other Android applications though it tested referring to your explanation. Please teach again.
What should I write in "Your.package.name"?
Moreover, what should I write in "HostAppPackageName"?

The one that starts by sendBroadcast is BitmapCatcher. This package name is "com.luaridaworks.smartwatch.bitmapcatcher".
In the test program, it wrote as follows. It continues to the following comment.

package com.luaridaworks.test02;
 import com.sonyericsson.extras.liveware.aef.control.Control;
 import com.sonyericsson.extras.liveware.aef.registration.Registration;
 import android.app.Activity;
 import android.content.Intent;
 import android.os.Bundle;
 public class Test02Activity extends Activity {
     /** Called when the activity is first created. */
     @Override
     public void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.main);

        Intent intent = new Intent(Control.Intents.CONTROL_START_REQUEST_INTENT);
        intent.putExtra(Control.Intents.EXTRA_AEA_PACKAGE_NAME, "com.luaridaworks.smartwatch.bitmapcatcher");
        intent.setPackage("com.luaridaworks.smartwatch.bitmapcatcher");
        sendBroadcast(intent, Registration.HOSTAPP_PERMISSION);
     }
 } 

由于BitmapCatcher没有启动,目的是改写如下所示,测试。

Because BitmapCatcher did not start, Intent was rewritten as follows and it tested.

intent = new Intent(Control.Intents.CONTROL_START_REQUEST_INTENT);
intent.putExtra(Control.Intents.EXTRA_AEA_PACKAGE_NAME, "com.luaridaworks.smartwatch.bitmapcatcher");
intent.setPackage("com.sonyericsson.extras.liveware");
sendBroadcast(intent, Registration.HOSTAPP_PERMISSION);

它没有启动类似。目的是改写为和测试。

It did not start similarly. Intent was rewritten as follows and tested.

intent = new Intent(Control.Intents.CONTROL_START_REQUEST_INTENT);
intent.putExtra(Control.Intents.EXTRA_AEA_PACKAGE_NAME, "com.luaridaworks.smartwatch.bitmapcatcher");
intent.setPackage("com.luaridaworks.test02");
sendBroadcast(intent, Registration.HOSTAPP_PERMISSION);

它没有启动类似。目的是改写为和测试。

It did not start similarly. Intent was rewritten as follows and tested.

intent = new Intent(Control.Intents.CONTROL_START_REQUEST_INTENT);
intent.putExtra(Control.Intents.EXTRA_AEA_PACKAGE_NAME, "com.luaridaworks.test02");
intent.setPackage("com.luaridaworks.smartwatch.bitmapcatcher");
sendBroadcast(intent, Registration.HOSTAPP_PERMISSION);

它没有启动类似。目的是改写为和测试。

It did not start similarly. Intent was rewritten as follows and tested.

intent = new Intent(Control.Intents.CONTROL_START_REQUEST_INTENT);
intent.putExtra(Control.Intents.EXTRA_AEA_PACKAGE_NAME, "com.sonyericsson.extras.liveware");
intent.setPackage("com.luaridaworks.smartwatch.bitmapcatcher");
sendBroadcast(intent, Registration.HOSTAPP_PERMISSION);

它没有启动类似。它尚未成功。
请给命名com.luaridaworks.test02其中com.luaridaworks.smartwatch.bitmapcatcher通常是从应用程序启动程序code中的例子。

It did not start similarly. It has not succeeded yet.
Please give the example of the program code named com.luaridaworks.test02 in which "com.luaridaworks.smartwatch.bitmapcatcher" is usually started from the application program.

推荐答案

您请求通过发送START_REQUEST意图开始您的扩展,如在SDK工具类中定义。也有这样的第6.1节中的 SDK

You request to start your extension by sending the START_REQUEST intent, as defined in the SDK utility classes. There is also a reference of this in chapter 6.1 in the API specification of the SDK.

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);

参考your.package.name是被存储到扩展的数据库,当您的分机注册的包名。如果你看一下SDK中的例子,每个扩展例子有一个SampleRegistrationInformation用方法的 getExtensionRegistrationConfiguration 的。这是在登记经由ContentProvider的存储到数据库中。下面的行存储您的包名。

The reference "your.package.name" is the package name that was stored to the extension database, when your extension was registered. If you look at the examples in the SDK, each extension example has a SampleRegistrationInformation with a method getExtensionRegistrationConfiguration. This is where the registration is stored to the database via a ContentProvider. The following line stores your package name.

values.put(Registration.ExtensionColumns.PACKAGE_NAME, mContext.getPackageName());

我想,从看你的例子,你的包名是com.luaridaworks.smartwatch.bitmapcatcher?

I think, from looking at your examples, that your package name is "com.luaridaworks.smartwatch.bitmapcatcher"?

hostAppPackageName 的是SmartWatch的主机应用程序的包名。有关此包的名称信息发送与从主机应用程序接收每个意图。在SDK样品,我们在一个全局变量保存在主机应用程序包的名称供以后使用,因此在code到的 hostAppPackageName 的参考。我谈的更多一点关于这<一href="http://stackoverflow.com/questions/10869538/sony-smartwatch-how-to-get-host-app-package-name">this问题。如果您想为C主机应用程序包的名称硬$ C $,这是它:com.sonyericsson.extras.smartwatch。 但是,我建议你不要,因为它可能在未来改变。

The hostAppPackageName is the package name of the SmartWatch host application. Information about this package name is sent with every intent that you receive from the host application. In the SDK samples, we store the host app package name in a global variable to be used later, hence the reference in the code to hostAppPackageName. I talk a bit more about this in this question. If you want to hard code the host app package name, this is it: com.sonyericsson.extras.smartwatch. But I recommend you don't, since it could change in the future.

于是,以下(硬编码)应该为你工作:

So, the following (with hard coding) should work for you:

Intent intent = new Intent(Control.Intents.CONTROL_START_REQUEST_INTENT);
intent.putExtra(Control.Intents.EXTRA_AEA_PACKAGE_NAME, "com.luaridaworks.smartwatch.bitmapcatcher");
intent.setPackage("com.sonyericsson.extras.smartwatch");
sendBroadcast(intent, Registration.HOSTAPP_PERMISSION);

这篇关于我应该怎么做才能开始从计划code SmartWatch的扩展?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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