Search Unity

Bluettoth permission not included in the final AndroidManifest.xml

Discussion in 'Editor & General Support' started by pplanza2, Dec 20, 2020.

  1. pplanza2

    pplanza2

    Joined:
    Dec 20, 2020
    Posts:
    1
    Hello,

    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/


    <?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!!
     
  2. FullDraw

    FullDraw

    Joined:
    Sep 18, 2017
    Posts:
    13
    I'm having the same issue, have you found a work around??
     
  3. oroivirtual

    oroivirtual

    Joined:
    Aug 28, 2019
    Posts:
    5
    I'm on the same boat
     
  4. Andriucha

    Andriucha

    Joined:
    Dec 17, 2012
    Posts:
    1
    It seems the problem is being caused by Oculus XR Plugin since version 1.5.0. The plugin is removing the BLUETOOTH permission from builds [https://docs.unity3d.com/Packages/c...include-in-final-apk-using-unity-oculus-quest]

    I guess there are two solutions:
    1. Downgrade to version 1.4.3
    2. Edit the
    OculusBuildProcessor.cs
    file found in Packages/Oculus XR Plugin/Editor and comment the line where the BLUETOOTH permission is removed.

    The line in question is #434:
    Code (CSharp):
    1. RemoveNameValueElementInTag(manifestDoc, nodePath, "uses-permission", "android:name", "android.permission.BLUETOOTH");
     
    minsley, VirtualPierogi and GCCooper like this.