How do I disable Android RECORD_AUDIO permission while still using other Media permissions?

  • 2
  • Problem
  • Updated 4 years ago
  • In Progress
My app plays HTML5 audio, and I build it with PhoneGap Build, so I have <gap:plugin name="org.apache.cordova.media"/> in config.xml. However, on Android, this expands (in AndroidManifest.xml) to

<uses-permission android:name="android.permission.RECORD_AUDIO"/><uses-permission android:name="android.permission.MODIFY_AUDIO_SETTINGS"/>

I do not need RECORD_AUDIO permission, because I don't record any audio (I just play it), and it makes some people suspicious (they ask "why does this app need access to the microphone?"), so I would like to turn it off. However, I do not know how.

http://docs.build.phonegap.com/en_US/... explains how to alter my AndroidManifest.xml by making changes in my config.xml for PhoneGap Build. However, I would like to entirely *remove* an element from AndroidManifest.xml -- specifically, <uses-permission android:name="android.permission.RECORD_AUDIO"/>. Can I do that?

The docs suggest that I should point at the parent element and provide replacement XML for its content. However, the parent of uses-permission is... the root element. Which means that I'd have to provide the whole entire AndroidManifest.xml content in config.xml, which rather defeats the point of PGB calculating it for me!
Photo of stuart.langridge

stuart.langridge

  • 12 Posts
  • 1 Reply Like

Posted 6 years ago

  • 2
Photo of Zahir

Zahir

  • 3500 Posts
  • 40 Reply Likes
As stated in this thread.
You can remove all permission except INTERNET.
Photo of 7oka _

7oka _

  • 10 Posts
  • 0 Reply Likes
I think the question was more like: RECORD_AUDIO permission is automatically added to the list of required permissions, although the application only plays sound (Does not record anything). This is a bit suspicious for the application users. I have the same issue.
Photo of ismael jimoh

ismael jimoh

  • 4116 Posts
  • 192 Reply Likes
Hi 7oka,

You can use the configap app to modify permissions added into your app.

It has a page that lets you specify which plugins you want added/removed.

Do let us know if that helps.
Photo of 7oka _

7oka _

  • 10 Posts
  • 0 Reply Likes
I tried configap:
When feature name="http://api.phonegap.com/1.0/media" is generated RECORD_AUDIO is still there, in addition to RECORD_VIDEO as well.

I played around with configap and
when gap:plugin name="org.apache.cordova.media" is generated, it's giving me the same old redundant permission RECORD_AUDIO.

Not sure exactly where in configap should I remove the extra permissions.
Photo of ismael jimoh

ismael jimoh

  • 4116 Posts
  • 192 Reply Likes
Hi 7oka,

Would test this out and let you know.
Photo of nbruley

nbruley

  • 35 Posts
  • 0 Reply Likes
Did anyone figure this out? I would like to do the same thing.
Photo of Petra V.

Petra V., Champion

  • 7794 Posts
  • 1391 Reply Likes
This thread explains how to do it since Nov 2014:
<gap:config-file platform="android" parent="/manifest" mode="delete">
<uses-permission android:name="android.permission.RECORD_VIDEO" />
</gap:config-file>

https://github.com/phonegap/build/iss...

However, I haven't seen a confirmation that this actually works as expected, yet.
Photo of nbruley

nbruley

  • 35 Posts
  • 0 Reply Likes
Thanks! I did indeed get it to work just now, with the help of this link as well:
http://community.phonegap.com/nitobi/...

It's not especially clear there, but the first widget line has to include xmlns:android="http://schemas.android.com/apk/res/android" in order for it to work.
Photo of JesseMonroy650 (Volunteer)

JesseMonroy650 (Volunteer), Champion

  • 3325 Posts
  • 122 Reply Likes
@nbruley
It's not especially clear there, but the first widget line has to include xmlns:android="http://schemas.android.com/apk/res/an..." in order for it to work.

This line defines to the build tool what the context is of you the line you have added. You will notice there is another line:
xmlns:gap = "http://phonegap.com/ns/1.0"
This line does something similar.

Jesse