如何在谷歌玻璃上顯示活卡?在開發活卡時,可能會有什麼特別需要照顧的問題。我已經創建了一個,但它不工作。這裏是我的服務代碼在Google眼鏡上創建活動卡片時出現問題。卡沒有顯示
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>
有什麼錯誤?我們需要更多信息。謝謝! – pt2121 2014-09-30 15:21:51
沒有錯誤,但卡沒有上傳到谷歌眼鏡上。 @EntryLevelDev – 2014-10-01 09:15:55