AppInventor: HOW TO: Turn your AI2 app into a Voice Activated App (Google Now)

Leading on from my initial enquiry here:

Using Google Now on your Android phone you can start several “Google” apps with voice commands.
It is possible to convert your AI2 app for the same thing. For the purposes of this howto:
The apk filename is  MyVoiceApp.apk
The appname is “My Voice App”   << what you see in the App Name on Screen 1 Designer
1. What you will need:
  • A PC
  • apktool (Windows/Linux) or AppToMarket (Windows)
  • Your apk file
2. Decode your apk using your preferred decoder/encoder
3. Browse to the res folder in the decoded apk and create a new folder called xml
 
4. Browse into the xml folder you have just created and create a new text file called searchable.xml
 
5. Open up searchable.xml and copy and paste this into it:

 

whilst replacing “My Voice App” with the appname of your app

Save searchable.xml.
6. In the root folder of your expanded apk, find the file “AndroidManifest.xml” and open it with your preferred text editor.
It may look something like this:  (the apkfilename and the appname should be correct in this file and match that of your apk)

 

7. You now need to add a new intent filter section and some configuration lines. Do this just above the <intent-filter> line

This is what you should add:
           

 

and your resultant AndroidManifest.xml file should then look like this:

 

Once this is done, save AndroidManifest.xml, and your work on editing the apk is done!

8. Now re-encode your apk using your preferred encoder/decoder, deal with the signing and zip aligning of apk as needed.
Sideload you new apk onto your device
Get Google Now running and ask it to: “run ‘My Voice App'” or “start ‘My Voice App'”  (both seem to work for different things???)
Your app should open up from closed or in the background.
If you need help with how to use apktool, just ask.
Tim
Credits due to the original poster on techrepublic here

Leave a Reply

Your email address will not be published. Required fields are marked *