Welcome to the Oculus Developer Forums!

Your participation on the forum is subject to the Oculus Code of Conduct.

In general, please be respectful and kind. If you violate the Oculus Code of Conduct, your access to the developer forums will be revoked at the discretion of Oculus staff.
New to the forums? Click here to read the How To guide. -- Developers click here.

[Unity Notice] "Dangerous Permission Error" in Unity Mobile Applications Fix

imperativityimperativity Posts: 3,587 Valuable Player
edited December 2018 in Mobile Development

Our QA group has flagged a number of Unity-based apps as having a "dangerous permission" because they require a microphone. This is a confusing report for folks that don't intend to use a mic.

What's happening: in Unity, our Platform SDK (required to implement the entitlement check) also includes code for VOIP. Unity auto-adds the microphone permission to your Android Manifest at build time if it sees any code references to the Microphone class. The Platform SDK code contains such references, so the permission is added even if you do not use VOIP or any other mic function.

How to fix it: Find OculusPlatform/Scripts/MicrophoneInput.cs and remove all references to the Microphone class. In the latest version of the Platform SDK, there are two: line 18 and line 33. These lines can be commented out and replaced with microphoneClip = null; and int pos = 0; respectively.

Once references to the microphone class have been removed, Unity should stop inserting the microphone permission. Of course, using the above hack will break mic support. If you need mic support later, remember to go back and undo this change, or switch to the (superior) MicrophoneInputNative implementation.

To test this fix, uninstall your app and reinstall it fresh. Make sure you do not use the -g option when you do the install. Upon opening the app you should not see a prompt to accept the microphone permission. If the app opens with no prompt, everything is good.

Comments

  • MarkHenryCMarkHenryC Posts: 32 Oculus Start Member
    Thanks for the update.
  • MarkHenryCMarkHenryC Posts: 32 Oculus Start Member
    edited January 9
    Since the contents of those two files are commented out, I realised that there are two other files OVRMicInput.cs and OVRLipSyncMicInput that reference the Microphone class, so they're presumably the ones causing the manifest write. Should we be commenting these out if not used?

    UPDATE: seems to fix the problem
Sign In or Register to comment.