0

Need help to display a sample card in the glass timeline(refer image). All i need is to launch the card when one taps when "ok glass" is displayed and scroll to view the card(image 2), the same via voice command also does not work. I tried launching the same activity via adb shell it works perfectly fine, also i added an intent filter with MAIN/LAUNCHER category to the activity - it runs. I referred this link for this POC but nothing like the image is being displayed. Please help as to where am i going wrong - TIA

Activity:

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());
    }
}

Manifest File:

<?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>
userDK
  • 13
  • 1
  • 4
  • possible duplicate of [Why is my voice command missing from the ok glass menu in XE16?](http://stackoverflow.com/questions/23097828/why-is-my-voice-command-missing-from-the-ok-glass-menu-in-xe16) – Ben May 08 '14 at 15:22

1 Answers1

0

If you are using an unregistered voice command, your manifest.xml must include

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

See https://developers.google.com/glass/develop/gdk/starting-glassware for more details about using registered commands and unlisted commands and Why is my voice command missing from the ok glass menu in XE16? for some clarification and examples.

Community
  • 1
  • 1
Prisoner
  • 49,922
  • 7
  • 53
  • 105
  • thanks, this actually showed the card in the timeline - but still it does not recognize the "show hello world" voice command after ok glass. – userDK May 08 '14 at 13:27
  • 1
    I have found changes to custom voice commands sometimes require an uninstall and a reinstall, i haven't identified the exact scenario yet but in general when i make changes to triggers or commands i always uninstall (by command line uninstall) then reinstall. Maybe that helps the poster – Mark Scheel May 09 '14 at 18:42