在Android Wear语音功能语音、功能、Android、Wear

由网友(- 爱已成碍。)分享简介:我想添加语音功能的Andr​​oid Wear,并按照以下网址I am trying to add Voice Capabilities in Android Wear and following below URL https://developer.android.com/training/wearables/a...

我想添加语音功能的Andr​​oid Wear,并按照以下网址

I am trying to add Voice Capabilities in Android Wear and following below URL

https://developer.android.com/training/wearables/apps/ voice.html

下面是我的清单

<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
    package="com.example.demowearapp"
    android:versionCode="1"
    android:versionName="1.0" >

    <uses-feature android:name="android.hardware.type.watch" />

    <uses-permission android:name="android.permission.VIBRATE" />

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

    <application
        android:allowBackup="true"
        android:icon="@drawable/ic_launcher"
        android:label="@string/app_name"
        android:theme="@style/AppTheme" >
        <activity
            android:name=".MainActivity"
            android:label="@string/app_name" >
            <intent-filter>
                <action android:name="android.intent.action.MAIN" />

                <category android:name="android.intent.category.LAUNCHER" />
            </intent-filter>
        </activity>
        <activity
            android:name=".TaxiActivity"
            android:label="@string/app_name" >
            <intent-filter>
                <action android:name="com.google.android.gms.actions.RESERVE_TAXI_RESERVATION" />
            </intent-filter>
        </activity>
    </application>

</manifest>

但在我的LG g当我试图下面的语音命令看开不开我的活动......它只是显示谷歌的搜索结果。

But when i am trying below voice commands in my LG G watch it doesn't open my activity...it just showing Google search results

确定谷歌,让我打车

确定谷歌,叫我车

感谢。

推荐答案

有同样的问题。解决的办法是添加类别 android.intent.category.DEFAULT 的意图过滤器:

Had the same problem. The solution was to add the category android.intent.category.DEFAULT to the intent filter:

    <activity android:name=".TaxiActivity" android:label="@string/app_name">
        <intent-filter>
            <action android:name="com.google.android.gms.actions.RESERVE_TAXI_RESERVATION" />
            <category android:name="android.intent.category.DEFAULT" />
        </intent-filter>
    </activity>

如果您打开手机上的Andr​​oid Wear应用程序,你可以验证你的应用程序是在呼叫车下面声音行动可用。

If you open the Android Wear app on the phone you can verify that your app is available under "Call a car" beneath "Voice actions".

对于非英语的人还在使用语音命令,你应该仔细检查用于语音的语言有问题的命令您的设备上。将其更改为英语和尝试。如果仍然不工作,你可以尝试更改设备的语言为英语也。

For non-English speakers still having problems using the voice command you should double check the language used for voice commands on your device. Change it to English and try it out. If that still doesn't work you can try changing the device's language to English also.

阅读全文

相关推荐

最新文章