2

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!!

Pablo Lanza
  • 338
  • 1
  • 8
  • Were you able to solve the issue? I have the same problem. What wersion of oculus xr plugin are you running by any chance? Thanks – Lukáš Hejtmánek Jan 07 '21 at 14:44
  • The unique solution to work with Oculus xr plugin 1.5.0 was export java code and then compile and export from Android Studio. – Pablo Lanza Jan 26 '21 at 18:21

1 Answers1

0

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)

  • Im sure you response is valid. Reading the changelog... The BLUETOOTH permission is no longer added to the Android manifest when the Microphone class is used in a project... Im not using Microphone in my project. – Pablo Lanza Jan 26 '21 at 18:23
  • I know what the changelog says, I also know that the bluetooth permission is removed explicitly by unity during build with Unity xr package 1.5 and is NOT removed with 1.4.3. Interpret that as you will – Lukáš Hejtmánek Feb 11 '21 at 17:01
  • He actually agreed with you. =) – imerso Feb 14 '21 at 12:59