cancel
Showing results for 
Search instead for 
Did you mean: 

Unnecessary permission RECORD_AUDIO in Platform SDK for Unity

UmairEm
Level 3
Recently my app got rejected with note:

Your app is asking for excessive user permissions or using user permissions inappropriately.


Here are all the permissions appearing in build info:


android.permission.READ_EXTERNAL_STORAGE

android.permission.INTERNET

android.permission.WAKE_LOCK

android.permission.ACCESS_NETWORK_STATE

android.permission.RECORD_AUDIO

android.permission.WRITE_EXTERNAL_STORAGE

android.permission.READ_EXTERNAL_STORAGE


At this point, RECORD_AUDIO permission is not required but its included because of MicrophoneInput.cs script under OculusPlatform/Scripts. If I remove this file and related files which use Unity's Microphone class and build the app, RECORD_AUDIO permission is gone. It makes sense to include this file in a project which actually uses Microphone at some point. But I am never gonna need it. Shall I remove this file and related files (IMicrophone.cs, MicrophoneInputNative.cs)? Are there any other files in Platform SDK which should be removed to avoid bugs due to code dependency?

Please advice me how to fix this

Thanks

20 REPLIES 20

masta-yoda
Level 3
The `...\Assets\Oculus\Platform\Scripts\MicrophoneInput.cs` script says that:

// NOTE for android developers: The existence of UnityEngine.Microphone causes Unity to insert the 
// android.permission.RECORD_AUDIO permission into the AndroidManifest.xml generated at build time

I also discovered this:
https://docs.unity3d.com/560/Documentation/Manual/android-manifest.html

So basically in order to disable that permission any usage of `
UnityEngine.Microphone` should be commented out. 
But I really liked the solution @Innovae solution and decided to pursue that one. Turned out that is was working correctly, just a quick addition to registering the tools namespace of the manifest merge feature:

<manifest xmlns:android="http://schemas.android.com/apk/res/android"
   
package="com.example.myapp"
   
xmlns:tools="http://schemas.android.com/tools">
And the rest stays the same:

 <uses-permission android:name="android.permission.RECORD_AUDIO" tools:node="remove"/>

The resulted manifest can be checked here and it doesn't include the microphone permission:

<ProjectFolder>/Temp/StagingArea/UnityManifest.xml