Search code examples
androidunity-game-engineoculus

Android Permission is not include in final apk using Unity + Oculus Quest


I want to use bluetooth in my Oculus Quest device so I need to include android.permission.BLUETOOTH permission in the .apk generated by Unity.

I included the AndroidManifest.xml file below in the ../MyProject/Assets/Plugins/Android/ folder

<?xml version="1.0" encoding="utf-8"?>
<manifest
xmlns:android="http://schemas.android.com/apk/res/android"
package="com.unity3d.player"
xmlns:tools="http://schemas.android.com/tools">
<uses-permission android:name="android.permission.ACCESS_COARSE_LOCATION"/>
<uses-permission android:name="android.permission.BLUETOOTH_ADMIN"/>
<uses-permission android:name="android.permission.BLUETOOTH"/>
<uses-feature android:name="android.hardware.bluetooth_le" android:required="false"/>

<application>
<activity android:name="com.unity3d.player.UnityPlayerActivity"
android:theme="@StyLe/UnityThemeSelector">
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
<meta-data android:name="unityplayer.UnityActivity" android:value="true" />
</activity>
</application>
</manifest>

The permissions ACCESS_COARSE_LOCATION and BLUETOOTH_ADMIN was included but not the BLUETOOTH permission.

Im using Oculus Plugin + Unity 2019.4.16f1

I tried with Unity versions 2019.3.2.f1, 2020.1.0f1, 2020.1.9f1. Same result. Not work.

I cant believe it. Any idea?

Thanks in advance!!


Solution

  • The solution is to downgrade to the Unity oculus XR package version 1.4.3. I speculate that their 1.5.0 is forcefully removing the permissions from the manifest after building it (see the changelog reference to bluetooth permissions)