How to "Tell" Your Nexus 5 to Play Music, Toggle Settings, & Other Custom Voice Commands
When Google introduced their new launcher alongside the Nexus 5, one of the most innovative features was the "always listening" voice search, meaning that at any time you were on your home screen, triggering a Google search was as simple as saying "Okay, Google."
Combined with the unparalleled accuracy of Google's voice recognition service, all of the information found in a Google search that was once at your fingertips was now at the tip of your tongue.
As simple as this makes it to launch a voice search, the functionality it offers almost feels like a tease. Sure, Google Now lets you set alarms and reminders, but you can't do something as simple as toggling Wi-Fi or Bluetooth with it.
If your Nexus 5 will listen to what you say, why not make it hear more?
That's where the Xposed module Google Search API comes in, created by developer MohammadAG (whose mods we've covered numerous times here on softModder). Throw in some Tasker profiles with AutoVoice, and the possibilities become endless.
Open the Xposed Installer from your app drawer and head to the Downloads section. Search "Google Search API", tap on the module, and hit "Download" to launch installation.
Once the installation process is complete, a notification will appear to let you know that the module is not activated yet. Tap this notification, and on the following screen check the box next to Google Search API.
At this point, to make these changes take effect, you'll need to reboot your phone.
Once rebooted, head into the app and check the box next to Delay commands for GEL. This ensures that voice commands aren't misinterpreted as Google searches when triggered from your home screen.
The Prevent duplicate searches option can be left un-ticked unless you experience trouble with duplicate searches.
The Google Search API offers plugins to add functionality. First up is Voice Toggles, which adds the ability to toggle Wi-Fi, Bluetooth, and mobile data on or off. Hit this link from your Nexus 5's web browser to download the install file.
Once the download is finished, click the notification to launch the install process.
Use the same method to install Music Controls from this link. This plugin will add voice commands for controlling the playback of music on your device.
Without any further configuration, the following voice commands are now available. From your home screen, simply say "Okay, Google" followed by a command to trigger them.
- "Play music"
- "Pause music"
- "Resume music"
- "Play songs by <artist>"
- "Play song <title>"
- "Volume up"
- "Volume down"
- "Volume max"
- "Turn on/off WiFi"
- "Turn on/off Bluetooth"
- "Turn on/off mobile data"
AutoVoice is a Google Search API plugin that also offers a plugin for the automation app Tasker. If you don't already have Tasker, tap on this link to install a free 7-day trial—definitely worthwhile if only to tinker with the functionality that AutoVoice has to offer.
To install AutoVoice, search for it on the Google Play or use this link.
Open AutoVoice, and scroll down to the Google Now Integration section. Here you'll need to tick the box next to Enable to get it to tie in with the Google Search API.
Next, tap the Search Type entry to choose whether you want AutoVoice to trigger events when you search by voice, by typing, or both. For the purposes of this tutorial, the rest of the AutoVoice settings can be left at their default values.
AutoVoice lets you set custom commands that can in turn trigger a Tasker task. This means that almost anything your phone can do can be triggered by voice. The possibilities are virtually endless, but I'll walk you through a relatively simple example here to get you started.
Open Tasker and hit the plus button at the bottom to create a new profile. In the following menus, select State, then Plugin, then AutoVoice Recognized.
In the ensuing screen, hit the pencil-shaped edit button near the top-right. This will open an AutoVoice configuration dialog.
Tick the box next to the top option, Event Behaviour, then scroll down and click Command Filter. This is the word that, if spoken on the home screen following the "Okay, Google" trigger, will launch the task you will create. The free version of AutoVoice limits this word to 4 characters, so in this example we'll enter the word "time". Hit the check icon near the top-right to save your entries.
From here, hit your phone's back button and you will be prompted to select a task to attach to this profile. Click New Task, then at the next prompt enter a name for your task and hit the check button.
Hit the plus button at the bottom of the next screen, and in this example, we'll select App from the following list. Now click Load App and select Clock from the list. Hit the back button three times to back entirely out of Tasker so that your new profile will become active.
From your home screen now, say "Okay, Google" followed by the command filter you entered—in this case "time".
This is just one simple example, but as I said earlier, the possibilities are nearly endless.
The only real limitation here is your own imagination, so get creative. From home automation to Chromecasting, your Nexus 5 will now obey your every command.