How to Implement Voice Interactions into Your Android App

4.6 / 5.0
Article rating

Tapping and scrolling is great, but voice control is the next step. The rise of voice-based AI and voice-controlled gadgets like Amazon Echo and Google Home show clearly that controlling software by voice is a trend. Here you’ll find out how to integrate voice control into your Android app and benefit from it.

In 2015, Google released a new version of Android called Marshmallow. Marshmallow included the Google Voice Interaction API for developers. Google’s Voice Interaction API connects voice control to all apps on a device that support it. As a result, a user can make a request and it will be fulfilled with any app that’s able to do so. Then the user can control that app using voice commands. Find out more about Google assistant integration.

Benefits of Voice Interaction

Controlling devices by voice is becoming more popular each year. It allows users to get information when they find it uncomfortable to use the screen. For example, I always use voice commands to find chords while playing the guitar and to find recipes while cooking, as do 23% of adults in US according to Northstar Research. So, why add voice capabilities on an app?

Companies that have already added Google Assistant actions to their apps, including TripAdvisor, Telegram, Walmart, and Flixster, have gained serious advantages over their competitors.

According to a study by Google, 55% of all teenagers and 41% of adults use voice commands more than once a day to find routes, make calls, and dictate texts. With time, the abilities of voice control become broader, and Google promises to add lots of new skills. Gartner predicts that by 2020, about 30% of searches will be done without a screen. ComScore gives an even more promising forecast, saying that 50% of searches will be done with voice by 2020.

Ecommerce development services
Are you planning to expand your business online? We will translate your ideas into intelligent and powerful ecommerce solutions.

These statistics show that it’s only a matter of time until it becomes common practice for people to use voice commands to find an address or play music. After you add voice control support to your app, it will appear in the list of apps that can perform a certain action. After a user chooses your app a few times while using voice control, Google will remember that preference and won’t ask again, opening your app by default for this type of request.

google assistant voice control
Google Assistant, like other voice control tools, is becoming more and more popular each day

Want to add voice commands to Android app? Companies that have already added Google Assistant actions to their apps, including TripAdvisor, Telegram, Walmart, and Flixster, have gained serious advantages over their competitors. So, consider Google Assistant development.

Voice commands are of use in almost any kind of app: fitness, list-making, cooking, healthcare, ecommerce, and video streaming. For location-based apps, voice control will soon become a must, as asking for directions is the most popular reason to use voice commands. Also, voice control is one of the main accessibility features, so if you want to make your app accessible, you should definitely implement voice interaction.

Voice Interaction commands

When voice interactions appeared, there weren’t many commands available. Now the situation has changed, and the abilities of Google’s voice search are impressive.

Let’s explore the most useful commands that could be helpful for your voice interaction service Android app.

  • Get directions
  • Find nearby places
  • Find travel plans
  • Book a table
  • Track a package
  • Set reminders
  • Call or text someone
  • Start a video call
  • Play music or video

Of course, this isn’t the whole list of what a user can do with voice commands, but these are easy to imagine in a third-party application.

Soon, voice interactions will offer even more interesting functions. For example, according to Google, ordering food through voice commands is the most anticipated feature, and it may be available soon. This will make food ordering apps even more convenient!

Food ordering app development is only one of the industries that’s going to have voice recognition AI implemented into its products. Logistics, tourism, healthcare and entertainment are exploring the ways they can utilise this technology and make their services even better.

Now let’s see how to integrate voice search in Android app.

Integrating voice interactions

There are four major steps you need to take to integrate voice interactions into your mobile app.

Step 1

First, you need to define Android versions and library versions you’ll support in your app. Mention them in your manifest to support voice commands.

android {
 compileSdkVersion 27
   buildToolsVersion '27.0.3'

 defaultConfig {
    minSdkVersion 23
       targetSdkVersion 27

Step 2

Next, you need to set up an Intent Filter in the manifest to connect to Google Now and receive the voice intent from it. In this example, we ask our app to take a picture and launch a camera:

    <action android:name=""/>>
    <category android:name="android.intent.category.DEFAULT"/>
    <category android:name="android.intent.category.VOICE"/>

This is the code you need to activate search in your app:

    <action android:name=""/>
    <category android:name="android.intent.category.DEFAULT"/>
    <category android:name="android.intent.category.VOICE"/>

Don’t forget to mention not only the voice category but also a default category.

You can create lots of such intent filters for anything you wish to support.

Step 3

Check your setup for voice interaction and use the handleQuery(query) method to process the search query.

String action = intent.getAction();
if (action.equals(Intent.ACTION_SEARCH)) {  
    String query = intent.getStringExtra(SearchManager.QUERY); 
        handleQuery(query); }

Step 4

Set up Google’s Voice Interaction API.

As one option can have many synonyms, add as many as you like within the option array. This will make successful responses more likely.

VoiceInteractor.PickOptionRequest.Option option1 =
        new VoiceInteractor.PickOptionRequest.Option(“Great Britain”, 1); 
    option.addSynonym(“United Kingdom”); 

VoiceInteractor.PickOptionRequest.Option option2 =
        new VoiceInteractor.PickOptionRequest.Option(“USA”, 1);

        .submitRequest(new PickOptionRequest("What is your favorite country?”, new Option[]{option1, option2}, null) {
            public void onPickOptionResult(boolean finished, Option[] selections, Bundle result) {
                if (finished && selections.length == 1) {
                    //Use the index of the options array to determine what was said
            public void onCancel() {

How the Google Voice Interaction API works

Creating a conversation through the Voice Interaction API requires these four steps:

  • Retrieve the voice interactor
  • Submit a request to the voice interactor
  • Google handles the conversation
  • Handle the callback

Submitting a request is the most important part for a developer because everything else is handled by Google. Here’s a list of requests that developers can use:

PickOptionRequest (VoiceInteractor.Prompt prompt, Option[] options, Bundle extras) allows you to add any number of options. Each can contain different response strings that represent one value.

AbortVoiceRequest (VoiceInteractor.Prompt prompt, Bundle extras) is necessary if a voice interaction can’t proceed, as it will return the user to the app’s basic UI.

CommandRequest (String command, Bundle args) adds command strings that Google will use to retrieve relevant information, for example numbers or dates.

CompleteVoiceRequest (VoiceInteractor.Prompt prompt, Bundle extras) returns a user to the basic UI of the app if the voice interaction is successful.

ConfirmationRequest (VoiceInteractor.Prompt prompt, Bundle extras) is for situations when you need security confirmation from a user (e.g. while making a payment with a credit card).

Prompt (CharSequence[] voicePrompts, CharSequence visualPrompt) is the prompt that most requests need. The first string is the prompt and the second is what will be shown to your user.

Now you know how to give your app’s users the ability to control your app with voice. This can be a really useful feature and a serious advantage over your competitors. If you have any questions, be sure to write to Mobindustry. We can provide you technical assistance and advice on integrating voice interactions into your application.

Google Assistant new features

Want to use google assistant in Android app? This news might be useful for Google Assistant integration. At the end of June 2020, Google released new updates to both Assistant’s features and programming back-end at the annual Voice Global conference.

User updates

Media API

With this new feature, you will be able to pick up progress between Google Assistant devices, so if you pause media in the lounge you’ll be able to continue that in the bedroom.

Home Storage

The Home storage feature allows Google Assistant developers to make experiences that can save their state acres smart displays. This feature is developed to remember the state across devices for multiple users across multiple displays.

AMP pages on Smart Displays

AMP is a collection of web standards that can enable a wide range of functionality.
This move can make the smart display a more complete computing platform.

Continuous Match Mode

Continuous Match Mode introduces the ability for Assistant to “leave the mic open” after a user initiates an Assistant Action. This lets the user conduct a continuous conversation with the Assistant with no waiting time for the device to be ready to listen.

Developer updates

Action Builder

Action Builder is a new web-based IDE (Integrated Development Environment) that provides developers with a graphical user interface for developing conversation flows. The tool is intended to make rapidly developing conversation flows easier, especially for those without a strong coding background.

Actions SDK

Action SDK integrates with the IDE of your choice providing a command-line interface for programming Actions. It also integrates with Action builder and the Action Console.

Android app development services
Are you planning to expand your business online? We will translate your ideas into intelligent and powerful mobile solutions.

Rate the article!

🌕 Cool!
🌖 Good
🌗 So-so
🌘 Meh
🌑 …