0

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.

JuiCe
  • 4,132
  • 16
  • 68
  • 119

1 Answers1

1

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.

ianhanniballake
  • 191,609
  • 30
  • 470
  • 443
  • Is there a way to know if another app's permissions have been granted? – JuiCe Mar 08 '17 at 03:37
  • This information made me find [this post](http://stackoverflow.com/questions/3353773/retrieve-permissions-list) and [this post](http://stackoverflow.com/questions/4386823/how-to-get-manifest-permissions-of-any-installed-android-app). I will mark as answered when I test in the morning. – JuiCe Mar 08 '17 at 03:45
  • Yep, you'll want to use [checkPermission](https://developer.android.com/reference/android/content/pm/PackageManager.html#checkPermission(java.lang.String,%20java.lang.String)) to check if the permission is granted with the package name gotten from the results of [queryIntentActivities](https://developer.android.com/reference/android/content/pm/PackageManager.html#queryIntentActivities(android.content.Intent,%20int)) (as it might not always be the Google app). – ianhanniballake Mar 08 '17 at 03:46