Open nitish3693 opened 1 year ago
Same error UNITY 2022.3.9f1
04:31:24.783
AndroidRuntime
FATAL EXCEPTION: Thread-6
04:31:24.783
AndroidRuntime
Process: com.DefaultCompany.HapticHand2022Test, PID: 9743
04:31:24.783
AndroidRuntime
java.lang.SecurityException: Need android.permission.BLUETOOTH_CONNECT permission for android.content.AttributionSource@26545bbe: AdapterService getBondedDevices
04:31:24.783
AndroidRuntime
at android.os.Parcel.createExceptionOrNull(Parcel.java:2426)
04:31:24.783
AndroidRuntime
at android.os.Parcel.createException(Parcel.java:2410)
04:31:24.783
AndroidRuntime
at android.os.Parcel.readException(Parcel.java:2393)
04:31:24.783
AndroidRuntime
at android.os.Parcel.readException(Parcel.java:2335)
04:31:24.783
AndroidRuntime
at android.bluetooth.IBluetooth$Stub$Proxy.getBondedDevices(IBluetooth.java:3077)
04:31:24.783
AndroidRuntime
at android.bluetooth.BluetoothAdapter.getBondedDevices(BluetoothAdapter.java:2491)
04:31:24.783
AndroidRuntime
at com.senseglove.sgconnect.BluetoothPorts.GetSGDevices(BluetoothPorts.java:64)
04:31:24.783
AndroidRuntime
at com.senseglove.sgconnect.DeviceScanner.UpdateConnections(DeviceScanner.java:212)
04:31:24.783
AndroidRuntime
at com.senseglove.sgconnect.DeviceScanner.RunScanner(DeviceScanner.java:147)
04:31:24.783
AndroidRuntime
at com.senseglove.sgconnect.DeviceScanner$1.run(DeviceScanner.java:54)
04:31:24.783
AndroidRuntime
at java.lang.Thread.run(Thread.java:920)
For hotfix added permission to android manifest. And get bruteforce permission.
#if UNITY_ANDROID
if (!Permission.HasUserAuthorizedPermission(Permission.CoarseLocation)
|| !Permission.HasUserAuthorizedPermission(Permission.FineLocation)
|| !Permission.HasUserAuthorizedPermission("android.permission.BLUETOOTH_SCAN")
|| !Permission.HasUserAuthorizedPermission("android.permission.BLUETOOTH_ADVERTISE")
|| !Permission.HasUserAuthorizedPermission("android.permission.BLUETOOTH_CONNECT"))
{
Permission.RequestUserPermissions(new string[]
{
Permission.CoarseLocation,
Permission.FineLocation,
"android.permission.BLUETOOTH_SCAN",
"android.permission.BLUETOOTH_ADVERTISE",
"android.permission.BLUETOOTH_CONNECT"
});
}
else
{
SceneManager.LoadScene(1);
}
Looking into this issue.
Adding the Bluetooth permission to the android manifest didn't work for us as the oculus XR plugin deletes all Bluetooth permissions from the manifest when building the application. For someone facing the same issue here's our solution: Adding the script as described here: https://communityforums.atmeta.com/t5/Quest-Development/SecurityException-when-accessing-Bluetooth-API/td-p/850586 with all needed permissions. Then giving the application Bluetooth and Location permissions in the Meta Quest settings.
When using the Senseglove integration with the new API Target 32 (new Minimum Requirement for the Oculus Store) the app is crashing due to Bluetooth permissions.
Setup :
Unity : 2021.3.14f1