【发布时间】: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