Android 在google glass上创建live card时出现问题。没有显示卡
如何在google glass上显示live card??在开发live card时需要特别注意哪些问题。我已经创建了一个live card,但它不起作用。这是我的服务代码Android 在google glass上创建live card时出现问题。没有显示卡,android,google-glass,google-gdk,Android,Google Glass,Google Gdk,如何在google glass上显示live card??在开发live card时需要特别注意哪些问题。我已经创建了一个live card,但它不起作用。这是我的服务代码 public int onStartCommand(Intent intent, int flags, int startId) { // TODO Auto-generated method stub if (livecard == null) { livecard = new L
public int onStartCommand(Intent intent, int flags, int startId) {
// TODO Auto-generated method stub
if (livecard == null) {
livecard = new LiveCard(this, "tag");
// live card view
remote = new RemoteViews(getPackageName(),
com.example.livecardnew.R.layout.live_card);
livecard.setViews(remote);
// live card menu activity
Intent menuIntent = new Intent(this, MenuActivity.class);
menuIntent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK
| Intent.FLAG_ACTIVITY_CLEAR_TASK);
// issue ths card when tapped
livecard.setAction(PendingIntent.getActivity(this, 100, menuIntent,
0));
livecard.publish(LiveCard.PublishMode.REVEAL);
}
else {
livecard.navigate();
}
return Service.START_STICKY;
}
AndroidManifest.xml
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.example.livecardnew"
android:versionCode="1"
android:versionName="1.0" >
<uses-sdk
android:minSdkVersion="15"
android:targetSdkVersion="17" />
<application
android:allowBackup="true"
android:icon="@drawable/ic_launcher"
android:label="@string/app_name" >
<!-- android:theme="@style/AppTheme" -->
<activity
android:name=".MenuActivity"
android:label="@string/app_name" >
</activity>
<service
android:name="com.example.livecardnew.MyService"
android:enabled="true"
android:exported="true"
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>
<meta-data
android:name="com.google.android.glass.VoiceTrigger"
android:resource="@xml/voice_trigger" />
</service>
</application>
它是未记录的,但是您必须使用setAction方法将意图添加到LiveCard中,否则它将不会显示…您正在执行的操作…所以不是这样
您是否100%确定正在调用onStartCommand,并且您的逻辑正在运行,以达到应该设置和显示LiveCard的代码?有条不紊地登录,也许吧。有错误吗?我们需要更多的信息。谢谢没有错误,但该卡没有上传到谷歌眼镜@当我们的应用程序启动时,或者当用户滚动ayaya并选择与我们的卡对应的菜单时,第一次调用EntryLevel DevStartCommand。如果我在这一点上出错,请纠正我。还有一件事是,在服务类中,当我创建意图时,我传递了MenuActivity.class的引用,这是我的活动类,因为我想在我的live card和一些视频中附加菜单,我看到了服务类的参考。那么原因是什么。我也使用语音触发器通过语音命令运行它。因此,只有可用的语音触发器,我的意思是只有官方的,可以通过语音命令触发我们的应用程序。或者我们可以使用Voice_trigger.xml文件中的命令。您应该通过隔离单个问题来关注它。在这种情况下,您的问题是LiveCard没有显示,因此请关注这一点,并删除外部因素,如语音触发和您想要构建的意图的性质。听起来你是在假设服务启动,而不是看到它启动-使用日志来确定。我找到了解决方案。问题是语音触发器。只有官方的语音触发器才能使用。我们如何在google glass中创建列表视图?例如,如果我们想在单击特定选项后显示项目列表。