Android 12 + 13: "This application is missing permissions: android.permission.BLUETOOTH" while permissions are granted
zmukash opened this issue · 2 comments
Bug Summary
On a Android 11 device my App works as expected because the android.permission.BLUETOOTH can be granted. With Android 12 the Bluetooth permissions changed and the SdlBroadcastReceiver throws an error shown below.
I checked and the BLUETOOTH_CONNECT permissions is granted as well as the BLUETOOTH_SCAN permission (in Android 12 + 13). Also Location permissions are granted and bluetooth and location services are turned on
Reproduction Steps
- Follow SDL Installation Guide
- Try on Android 12 + 13
Expected Behavior:
Run Normally
Observed Behavior:
Error shown above
Which projects have you seen this bug on?
Android
Android Version(s)
12+13
Android Device(s)
One Plus Nord, Google Pixel 3a XL, Samsung A51
sdl_java_suite Version
5.6.1
Testing Environment(s)
Ford Car + Manticore (when using another connected bluetooth API it shows the same error when intent "android.bluetooth.device.action.ACL_CONNECTED" is received)
Relevant log output
-----------------------------------
Integration Validator Results:
-----------------------------------
✕ This application is missing permissions:
- android.permission.BLUETOOTH
✓ SdlRouterService checks were not performed yet due to supplied flags
✕ SdlBroadcastReceiver checks were not performed yet due to failing permission check
Please see the guides for how to fix these issues at www.smartdevicelink.com
at com.smartdevicelink.transport.SdlBroadcastReceiver.queryForConnectedService(SdlBroadcastReceiver.java:502)
at XXX.MainActivity.connectSdl(MainActivity.java:504)
at XXX.MainActivity.onCreate(MainActivity.java:294)
at android.app.Activity.performCreate(Activity.java:8129)
at android.app.Activity.performCreate(Activity.java:8109)
at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1344)
at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:3749)
... 12 more
Closing as not an issue.
While Android 12+ introduced new bluetooth permissions for specific API/events, your app still needs to include the specific bluetooth permission android.permission.BLUETOOTH
in the manifest as used with older Android versions.
Closing was the correct decision. Just wanted to leave a comment for my Bugfix for others. Apparently OnePlus (and sometimes other Manufacturers) seem to have incorrect implementations of the Bluetooth Spec. I had exactly the same issue as described in the post below and the solution was to change
<uses-permission android:name="android.permission.BLUETOOTH" android:maxSdkVersion="30" />
to
<uses-permission android:name="android.permission.BLUETOOTH" tools:remove="android:maxSdkVersion" />
which overwrites an already merged manifest line which would leave out the permission after a once defined maxSdkVersion. This solution was taken from Stackoverflow - Solution by Manuel B.