【问题标题】:Linking Mirror Api and GDK glassware App连接 Mirror Api 和 GDK glassware App
【发布时间】:2015-03-01 21:22:55
【问题描述】:

我正在尝试使用通过 Mirror API 插入的 Timeline 卡上的 MenuItem 在我的玻璃上启动 GDK 应用程序。我已经厌倦了所有可能的方法来使它工作,可能有一个我无法捕捉到的逻辑错误。

我以这些链接为起点。

Opening GDK Glassware through Mirror API Glassware MenuItem

Menu Item for "OPEN_URI" not present in menuItems return

How can I start an intent from a card in Google Glass

镜像 API 代码片段。

List<MenuItem> menuItemList = new ArrayList<MenuItem>();
            // Built in actions
            menuItemList.add(new MenuItem().setAction("NAVIGATE"));
            menuItemList.add(new MenuItem().setAction("DELETE"));

            List<MenuValue> values= new ArrayList<MenuValue>();
            //values.add(new MenuValue().setDisplayName("remember").setState("DEFAULT"));
            values.add(new MenuValue().setDisplayName("remembering").setState("LAUNCHER"));

            menuItemList.add(new 
          MenuItem().setAction("OPEN_URI").setPayload("exampleprotocol").setValues(values));
            timelineItem.setMenuItems(menuItemList);

GDK 应用程序(清单文件)

<service
            android:name="com.example.rajeev.memory.ElephantService"
            android:enabled="true"
            android:exported="true"
            android:icon="@drawable/ic_plus_50"
            android:label="@string/app_name">
            <intent-filter>
                <action android:name="com.google.android.glass.action.VOICE_TRIGGER" />
                <category android:name="android.intent.category.LAUNCHER" />
            </intent-filter>

            <intent-filter>
                <action android:name="android.intent.action.VIEW" />
                <category android:name="android.intent.category.BROWSABLE" />
                <category android:name="android.intent.category.LAUNCHER" />
                <category android:name="android.intent.category.DEFAULT" />
                <data android:scheme="exampleprotocol"/>
            </intent-filter>
            <meta-data
                android:name="com.google.android.glass.VoiceTrigger"
                android:resource="@xml/voice_trigger_start" />
        </service>

但是,我可以使用带有“Payload”的 OPEN_URI Action 启动 google 网站:“https://www.google.com/?gws_rd=ssl

【问题讨论】:

    标签: android android-intent google-glass google-gdk google-mirror-api


    【解决方案1】:

    在 servlet 的 setPayload() 调用中,使用 exampleprotocol://

    【讨论】:

    • 如果我将 setAction("OPEN_URI") 与 setPayload("exampleprotocol://") 一起使用,则 MenuItem 不会显示,但是如果我使用 setAction("CUSTOM") 但不会显示它'不启动应用程序而是刷新卡片。
    猜你喜欢
    • 1970-01-01
    • 2013-12-28
    • 1970-01-01
    • 1970-01-01
    • 2023-04-09
    • 2016-12-27
    • 2017-02-03
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多