Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to make Google Now run continually in the background on Android

I have a app idea in mind, but I haven't been able to figure out one part yet. In Google Now on Android, it gives you the following options to search:

  1. Type to search
  2. Click microphone to say your search
  3. Or just Say "Google" to make the voice search begin.

I'd like to know how they made #3 work. I need to have a keyword, that when said, initiates the voice search.

I imagine they have some type of background running service constantly listening for voice actions. Does anyone know how this is achieved?

Here is a image of the Google Now app:

enter image description here

like image 574
Kent Andersen Avatar asked Apr 25 '13 16:04

Kent Andersen


People also ask

How do I force an app to run in the background?

In order to make Android allow apps to run in background, all you need to do is press the open padlock icon right next to them. Once the open padlock changes and you get the “Locked” pop-up notification on your screen, you're all set!

What is background activity in Android?

"Allow background activity", under Battery, refers to whether apps are allowed to run in the background (when you're not using them onscreen, or the app is not visible to you) or not.


1 Answers

You can write a service and then use createSpeechRecognizer in that service. For a complete service code for this you can find the answer at Android Speech Recognition as a service on Android 4.1 & 4.2

like image 96
Hoan Nguyen Avatar answered Sep 22 '22 23:09

Hoan Nguyen