简体   繁体   中英

Is this possible to call ' Okay Glass' only once

Is this possible to call ' Okay Glass' only once rather than speaking ok glass every time before giving any voice command?

For example, I start my application and call 'Okay glass' once and start giving voice commands and switching to different activities by voice commands without repeating 'Okay glass' before each voice command.

If you have a list of items where each item has a sublist, you could use a menu:

res/menu/store.xml

<menu xmlns:android="http://schemas.android.com/apk/res/android">
    <item
        android:id="@+id/store"
        android:title="Buy an item">
        <menu>
            <item
                android:id="@+id/produce"
                android:title="Produce">
                <menu>
                    <item
                        android:id="@+id/apples"
                        android:title="Apples"/>
                    <item
                        android:id="@+id/bananas"
                        android:title="Bananas"/>
                    <item
                        android:id="@+id/lettuce"
                        android:title="Lettuce"/>
                    <item
                        android:id="@+id/guava"
                        android:title="Guava"/>
                </menu>
            </item>
            <item
                android:id="@+id/meat"
                android:title="Meat">
                <menu>
                    <item
                        android:id="@+id/pork"
                        android:title="Pork"/>
                    <item
                        android:id="@+id/beef"
                        android:title="Beef"/>
                    <item
                        android:id="@+id/chicken"
                        android:title="Chicken"/>
                </menu>
            </item>
        </menu>
    </item>
</menu>

I say "Ok Glass, buy an item" and it lists a menu with "Produce" and "Meat." Then I say "Produce" (without having to say "Ok Glass") and it lists the produce in the menu. When I say "Bananas," it opens the activity for buying bananas (see this project for details on that: https://github.com/alk2pb/GlassFoley/blob/master/app/src/main/java/com/example/team8capstone/glassfoley/video/VideoActivity.java ).

This answer might be relevant, too: How can I dynamically create menu items?

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM