Google Glass:卡未显示

时间:2014-05-08 12:49:16

标签: google-glass google-gdk

需要帮助才能在玻璃时间轴中显示样本卡(请参阅image)。我需要的是当显示“ok glass”时点击一下并启动卡片并滚动查看卡片(图片2),同样通过语音命令也不起作用。 我尝试通过adb shell启动相同的活动,它工作得非常好,我还为活动添加了一个带有MAIN / LAUNCHER类别的intent过滤器 - 它运行。我将此link称为此POC,但没有显示图像。请帮助我在哪里出错 - TIA

的活动:

package de.androidzeitgeist.glass.helloworld.immersion;

import android.app.Activity;
import android.os.Bundle;

import com.google.android.glass.app.Card;

public class HelloWorldActivity extends Activity {
@Override
protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);

    Card card = new Card(this);
    card.setText("Hello world!");
    card.setFootnote("android.com");

    setContentView(cardroid.getView());
    }
}

清单文件:

<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
    package="de.androidzeitgeist.glass.helloworld.immersion"
    android:versionCode="1"
    android:versionName="1.0" >

    <application
        android:allowBackup="true"
        android:icon="@drawable/helloworld_icon"
        android:label="@string/app_name" >

        <activity
            android:name="de.androidzeitgeist.glass.helloworld.immersion.HelloWorldActivity"
            android:icon="@drawable/helloworld_icon"
            android:label="@string/app_name" >
            <intent-filter>
                <action android:name="com.google.android.glass.action.VOICE_TRIGGER" />
            </intent-filter>
            <meta-data
                android:name="com.google.android.glass.VoiceTrigger"
                android:resource="@xml/voice_trigger" />
        </activity>
    </application>

    <uses-sdk
        android:minSdkVersion="19"
        android:targetSdkVersion="19" />

</manifest>

voice_trigger.xml

<?xml version="1.0" encoding="utf-8"?>
<trigger keyword="@string/show_hello_word" />

的strings.xml

<?xml version="1.0" encoding="utf-8"?>
<resources>

    <string name="app_name">HelloWorldImmersion</string>
    <string name="hello_world"></string>

    <string name="show_hello_word">show hello world</string>

</resources>

1 个答案:

答案 0 :(得分:0)

如果您使用的是未注册的语音命令,则manifest.xml必须包含

<uses-permission android:name="com.google.android.glass.permission.DEVELOPMENT" />

有关使用已注册命令和未列出命令的详细信息,请参阅https://developers.google.com/glass/develop/gdk/starting-glassware,有关说明和示例,请参阅Why is my voice command missing from the ok glass menu in XE16?