Search code examples
androidpermissionsmicrophone

Mic works without permission, but doesn't when revoking Google's Mic permission


I am using this SearchView library in my app. The RECORD_AUDIO permission is not part of my application but I can still use the voice search feature without being prompted for permission. However, if I disable the Google app's Microphone permission, the feature doesn't work. It doesn't crash or ask for permission, it just kind of stutters.

So my questions are:

  1. How is my app using the Google app's permissions like this?
  2. How can I handle a user that has disabled the Google app's Microphone permission?

Some info:

In the example app's AndroidManifest, the RECORD_AUDIO permission is listed, but I did not list it in mine.

I have checked both:

  • /app/build/intermediates/manifests/full/debug/AndroidManifest.xml
  • /app/build/outputs/logs/manifest-merger-debug-report.txt

Neither of the files have any mention of a RECORD_AUDIO permission. My application's permissions settings do not list Microphone as an option.


Solution

  • As seen in the source code, it uses the RecognizerIntent.ACTION_RECOGNIZE_SPEECH Intent, which is handled by the Google app. Therefore it is the Google app that is doing voice recognition (and hence, requires the RECORD_AUDIO permission), not your app.