Hello, I want to develop an app that it can listen to my voice at any time 
at any screen. For example, I can say "Hi Buddy", then it can be activated 
and listen to my words. it is just like "Ok Google".

I'm using a background service to listen on the microphone, onece a 
keyworkd "Hi Buddy" is detectd, then it will be launched.

The current problem is that, there is a race condition of the microphone 
with Google Now (and other apps like Recorder app). To avoid affecting 
other apps, I want to release the microphone when Google Now's micophone 
button on launcher panel is clicked, or it is on the voice input page of 
Google Now. But I don't know when other apps are attempt to use the 
microphone, and can't detect wheather Google Now is showing the voice input 
page or not. So I don't know when to release the microphone. So when I app 
is running,  other apps are not able to use the microphone.

I create the AudioRecord with MediaRecorder.AudioSource.VOICE_RECOGNITION. 
There is another source MediaRecorder.AudioSource.HOTWORD, but it is a 
hidden audio source and require the permission 
android.permission.CAPTURE_AUDIO_HOTWORD, I can't get the permission as a 
non-system app.

My questions are:
1. How to detect if other apps trying to use the microphone or not. (or how 
the get the android.permission.CAPTURE_AUDIO_HOTWORD permission)
2. How to know if Google Now is showing its voice input page or not?
3. Any other workaround?

Anyone can help?

Sincerely
Tony

-- 
You received this message because you are subscribed to the Google Groups 
"Android Developers" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To post to this group, send email to [email protected].
Visit this group at https://groups.google.com/group/android-developers.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/android-developers/c25598c6-ac73-4ba7-9973-ec91821c58a5%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to