How to create an Android Wear app with voice action recording?
I can't figure out how to create an Android Wear app that will allow me to use it to record notes via its built-in voice actions. I am declaring an 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>
It doesn't do anything, however, and the Wear app on the phone prevents me from setting the app as my default note-taking app. What do I need to do to make this happen?
source to share
The trick is to include the category android.intent.category.DEFAULT
as stated in the intent documentation . If it is absent, no implicit intent can be obtained by the application. It is also important to include the MIME type text/plain
. The complete declaration looks like this:
<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>
source to share
@Malcolm's answer by adding this line as well. It will work fine.
<action android:name="com.google.android.gm.action.AUTO_SEND" />
Full part
<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"/>
<action android:name="com.google.android.gm.action.AUTO_SEND" />
<data android:mimeType="text/plain"/>
source to share