如何创建与笔记语音操作的Android Wear应用程序? [英] How to create an Android Wear app with the note-taking voice action?
问题描述
我似乎无法找出如何创建一个Android Wear应用程序,它可以让我使用它通过内置语音操作做笔记。我宣布意图过滤器在添加语音功能说明的:
I can't seem to figure out how to create an Android Wear application which would allow me to use it to take notes via built-in voice actions. I declare the intent filter as stated in Adding Voice Capabilities:
<intent-filter>
<action android:name="android.intent.action.SEND"/>
<category android:name="com.google.android.voicesearch.SELF_NOTE"/>
</intent-filter>
然而,什么也不做,并在手机上的应用程序磨损不允许我设置应用程序为默认的笔记应用程序。什么我需要做的,做到这一点?
However, that does nothing, and the Wear app on the phone doesn't allow me to set the application as the default note-taking app. What do I need to do to make that happen?
推荐答案
关键是要包括该类别 android.intent.category.DEFAULT
,如<一说HREF =http://developer.android.com/guide/components/intents-filters.html#Receiving>上的意图的文档。如果缺少,没有隐含的意图可以通过应用程序来接收。此外,它是重要的,包括MIME类型文本/纯
。完整的声明如下:
The trick is to include the category android.intent.category.DEFAULT
, as stated in the documentation on intents. If it is missing, no implicit intents can be received by the app. Besides that, it is important to include the MIME type text/plain
. The complete declaration is as follows:
<intent-filter>
<action android:name="android.intent.action.SEND"/>
<category android:name="android.intent.category.DEFAULT"/>
<category android:name="com.google.android.voicesearch.SELF_NOTE"/>
<data android:mimeType="text/plain"/>
</intent-filter>
这篇关于如何创建与笔记语音操作的Android Wear应用程序?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!