I've recently updated to B4a 12.5 and everything seems to be working great with the TargetSDK set to 26 android:targetSdkVersion="26". When I move this to android:targetSdkVersion="33" as is recommended for upcoming Google Updates, I can no longer use my bluetooth classic or BLE functionality to get Paired devices with Starter.serial1.GetPairedDevices. I have tried using the instructions to request permission from the BLE Example but still end up with the error "Need android.permission.BLUETOOTH_CONNECT". I have tried adding these lines to the manifest
and added these lines of code to Activity.Create where I request all my permissions but still receive this error. The Wait appears to never return after the 1st permission is set.
Please let me know how I might correct this
Manifest Lines:
AddPermission(android.permission.ACCESS_FINE_LOCATION)
AddPermission(android.permission.BLUETOOTH_SCAN)
AddPermission(android.permission.BLUETOOTH_CONNECT)
Lines added to request permission:
Dim Permissions As List
Dim phone As Phone
If phone.SdkVersion >= 31 Then
Permissions = Array("android.permission.BLUETOOTH_SCAN", "android.permission.BLUETOOTH_CONNECT", rp.PERMISSION_ACCESS_FINE_LOCATION)
Else
Permissions = Array(rp.PERMISSION_ACCESS_FINE_LOCATION)
End If
For Each per As String In Permissions
rp.CheckAndRequest(per)
Wait For B4XPage_PermissionResult (Permission As String, Result As Boolean)
If Result = False Then
ToastMessageShow("No permission: " & Permission, True)
Return
End If
Next