Settings key: <bluetooth_address> is only readable to apps with targetSdkVersion lower than or equal: 31

// Expert user has replied.
D David Donayo 1 year ago
486 2 0

I have an application in Xamarin.Android which has an API level 33/Android 13, the app integrates with Zebra scanners and in this case I am trying to connect a Zebra DS3678 to my application. In previous versions (API Level < 31 / Android 12) The scanner connects perfectly but now I have the error that is in the title of the question.

Working with API Levels, I always notice that they touch and modify all Bluetooth issues but I couldn't find what should change for API Level 32 or higher (33 in my case)

I contacted the Zebra team but I had no answers (because I think a posible solution is upgrade the Zebra SDK Hander) and I can't downgrade either because it is a corporate app

This is my bluetooth configuration

<uses-sdk android:minSdkVersion="21" android:targetSdkVersion="33" />
<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" />
<uses-permission android:name="android.permission.READ_EXTERNAL_STORAGE" />
<uses-permission android:name="android.permission.INTERNET" />
<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" />
<uses-permission android:name="android.permission.ACCESS_WIFI_STATE" />
<!-- FOR 30 AND BELOW -->
<uses-permission android:name="android.permission.BLUETOOTH" />
<uses-permission android:name="android.permission.BLUETOOTH_ADMIN" />
<!-- for 31 and above -->
<uses-permission android:name="android.permission.BLUETOOTH_SCAN" />
<uses-permission android:name="android.permission.BLUETOOTH_CONNECT" />
<uses-permission android:name="android.permission.BLUETOOTH_ADVERTISE" />
<uses-permission android:name="android.permission.ACCESS_COARSE_LOCATION" />
<uses-feature android:name="android.hardware.bluetooth_le" android:required="true" />
<uses-permission android:name="android.permission.CAMERA" />
<uses-permission android:name="android.permission.FLASHLIGHT" />
<uses-permission android:name="android.permission.VIBRATE" />
<uses-permission android:name="android.permission.WRITE_SETTINGS" />
<uses-permission android:name="android.permission.WRITE_SOCIAL_STREAM" />
<uses-permission android:name="android.permission.WRITE_SECURE_SETTINGS" />
 

Please Register or Login to post a reply

2 Replies

R Richard Venderbosch

Perhaps this sample app may help you: https://github.com/darryncampbell/OEMInfo-DeviceIdentifiers-Sample-Xamarin

S Sean Kennedy

Hi David. 

This is restrictions on observable data specific to the device - that Google is no longer allowing direct programmable access to Mac Addresses for this reason (Starting in A11:  https://developer.android.com/training/articles/user-data-ids#mac-11-plus )

As you may have observed with the latest releases of "Zebra Scanner Control" app for Android, when you use the Bluetooth Classic modes - the app will REQUEST - that you (the User) supply the Bluetooth Mac Address interface Values. This gives you direct visibility as a user to share this data to an Android App.
 

For Instance as a User:
( Settings --> About Phone --> Bluetooth Address [Tap-Hold the menu line and choose "Copy"], and then you will have the "User" disclosable BT Mac address. )

 

Darryn's OEMInfo is a comprimise. And there are other methods, But the BT Mac Address you had access to - is no longer available to you programmatically after API Level: 33  This uses a Priviledged App technique to access the Device OEMInfo - to get the same attribute.

CONTACT
Can’t find what you’re looking for?