cancel
Showing results for 
Search instead for 
Did you mean: 

Unity Oculus Platform SDK Permission Issues

TrentLVR
Honored Guest
When I include the Oculus Platform SDK for unity it has code that forces unity to add the 2 permissions below
    <uses-permission android:name="android.permission.INTERNET"/>
    <uses-permission android:name="android.permission.RECORD_AUDIO"/>

I can remove the audio permission by modifying some of the code from the Oculus Platform SDK but this is a pain and I would prefer a solution where i do not have to modify the oculus platform sdk.

I am unsure if  <uses-permission android:name="android.permission.INTERNET"/> is either coming from my code or the Oculus Platformsdk or both.

I exported my project to an android studio project so i can manually modify the permissions that unity generates(not an ideal solution)

The android studio project gives me a gradle error 
Caused by: java.lang.RuntimeException: Cannot read packageName from C:\trent\olympia_oculus_go\build\Olympia\src\main\AndroidManifest.xml

Googling this issue does not have great results.

Is there any documentation  that shows how to build an oculus unity project in andoird studio that was generated from unity.
or
Is there a simple solution to remove permissions that i do not require in unity without modifying any of the code.(I use many plugins, i don't want to modify each for an Oculus build if possible)
the second solution is preferable.

Thanks for reading.
4 REPLIES 4

TrentLVR
Honored Guest
I have found a solution, technically the permission is still included in the android AndroidManifest.xml

Add the permissions you want to remove the generated AndroidManifest.xml file that the unity ocululs tools generates

then add the following to text to the permission
android:maxSdkVersion="1"

so:
<uses-permission android:name="android.permission.INTERNET"/>
would be:
<uses-permission android:name="android.permission.INTERNET" android:maxSdkVersion="1"/>


my complete android manifest ends up being


<?xml version="1.0" encoding="utf-8" standalone="no"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android">
    <application>
        <activity
            android:theme="@android:style/Theme.Black.NoTitleBar.Fullscreen"
            android:configChanges="locale|fontScale|keyboard|keyboardHidden|mcc|mnc|navigation|orientation|screenLayout|screenSize|smallestScreenSize|touchscreen|uiMode"
            android:launchMode="singleTask"
            android:name="com.unity3d.player.UnityPlayerActivity"
            android:excludeFromRecents="true">
            <intent-filter>
                <action android:name="android.intent.action.MAIN"/>
                <category android:name="android.intent.category.INFO"/>
            </intent-filter>
        </activity>
        <meta-data android:name="unityplayer.SkipPermissionsDialog" android:value="false" />
    </application>
    <uses-permission android:name="android.permission.INTERNET" android:maxSdkVersion="1"/>
    <uses-permission android:name="android.permission.RECORD_AUDIO" android:maxSdkVersion="1"/>
</manifest>

PaulAtWarp
Protege
I'm facing the same issue. Is this still the only way to solve it?

PaulAtWarp
Protege
Also, this doesn't solve the issue. It stops the app requesting the microphone but on the store details it still says that the app requires the microphone to record audio. Even though it doesn't. And there's no apparent option to turn it off.

PaulAtWarp
Protege
It seems the way to fix it is to hack out all of the code referring to microphone from the SDK.