Android: Creating wearable apps-voice actions

Source: Internet
Author: User

Add Speech processing power (Adding voice capabilities)

Voice operations are an important part of the wearable user experience, allowing users to perform actions in a fast, hands-free manner.

Wear offers two types of voice operations:

system-provided (system-provided)
These voice operations are task-based and built into the wear platform.
When the Voice command arrives, the action is filtered in the activity you want to start.
such as "Remember" (take a note) or "remind" (Set an alarm).
application Offers (app-provided)
These voice actions are app-based and are declared in the same way as the start icon. The user says "start" to use these voice actions and an activity that you specify.
Claims system-provided voice operations the Android Wear platform provides some voice intents based on user actions, such as "Remember" or "remind" above.
This allows the user to simply say what they want to do, and the system determines which activity to initiate in response.
When a user issues a voice command, your application can listen and filter on this intent, so that the appropriate application will be started by that voice intent (intent).
If you want to start a background service, display an activity in a way that is visible and then start the service on the activity.
When you want to get rid of this visible hint, make sure to call the finish () function.
For example, for the take a note command, declare the following intent filter (Intent Filter) to initiate an activity called mynoteactivity:
<activity android:name= "Mynoteactivity" >
<action android:name= "Android.intent.action.SEND"/>
<category android:name= ""/>
The following is a list of speech intent (voice intents) supported by the Wear platform:

Declare the voice action provided by the app if none of the above system speech intentions meet your requirements, you can start your app directly with the "Start myactivityname" Voice command.
Registering a "Start" action is similar to registering a startup icon on a mobile app.
To specify the text parameters that follow the Start command, you need to specify a label property for the activity.
For example, the following intent filter will recognize the "start Myrunningapp" voice operation and start the startrunactivity.
<activity android:name= "startrunactivity" android:label= "Myrunningapp" >
<action android:name= "Android.intent.action.MAIN"/>
<category android:name= "Android.intent.category.LAUNCHER"/>
Get free-form Voice input in order to initiate activity using voice actions, you can also call the system's built-in speech recognition activity (Speech recognizer activity) to get the user's voice input.
This is useful for speech recognition and subsequent processing, such as performing a search or sending a voice message.
In the application, you can use the Action_recognize_speech action to invoke the Startactivityforresult () function,

This initiates the activity and can process the speech recognition results in Onactivityresult ().

by Iefreer

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.