通过Mirror API Glassware MenuItem打开GDK Glassware [英] Opening GDK Glassware through Mirror API Glassware MenuItem

查看:47
本文介绍了通过Mirror API Glassware MenuItem打开GDK Glassware的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

此处所述,我在集成GDK Glassware和Mirror API Glassware时遇到问题.我需要使用Mirroe api Glassware应用程序MenuItem打开GDK玻璃器皿应用程序.我可以故意发送数据包吗?有人对此有想法吗?

I have problem integrating GDK Glassware and Mirror API Glassware as described here. I need to open GDK glassware application using Mirroe api Glassware app MenuItem. Can I send data bundle with intent. Does anybody have an idea about that.

谢谢.

推荐答案

我终于找到了一种解决方法

I have finally figured out a way to do that

  1. 首先将自定义方案添加到AndroidManifest.xml中的android活动标签

  1. First add your custom scheme to android activity tag in AndroidManifest.xml

 
  <activity
        android:name="com.sanath.MainActivity"
        android:label="@string/app_name" >
        <intent-filter>
            <action android:name="android.intent.action.MAIN" />
            <action android:name="com.google.android.glass.action.VOICE_TRIGGER" />
            <category android:name="android.intent.category.LAUNCHER" />
        </intent-filter>
        <intent-filter>
          <data android:scheme="com.sanath.scheme" />
          <action android:name="android.intent.action.VIEW" />
          <category android:name="android.intent.category.DEFAULT" />
        </intent-filter>
        <meta-data android:name="com.google.android.glass.VoiceTrigger"
        android:resource="@xml/vision_voice_trigger" />
    </activity>

Then in Glassware timeline MenuItem add like following

Then in Glassware timeline MenuItem add like following


new MenuItem(){
Action = "OPEN_URI",
Payload = "com.sanath.scheme://open/Welcome/2014",
Values = new MenuValue[]
        {
         new MenuValue()
         {
            DisplayName  = "Open",
            State = "DEFAULT"
         },
         new MenuValue()
         {
            DisplayName  = "Launching",
            State = "PENDING"
         },
         new MenuValue()
         {
             DisplayName  = "Launched",
             State = "CONFIRMED"
         },
         },
        },
    }

然后在Activity OnCreate方法中,您可以按以下方式获取数据

Then inside your Activity OnCreate method you can get data as following


   Uri data = getIntent().getData();
        List params = data.getPathSegments();
        String param0 = params.get(0); // "welcome"
        String param1 = params.get(1); //"2014"

希望这对其他人有帮助

这篇关于通过Mirror API Glassware MenuItem打开GDK Glassware的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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