Bluetooth SecurityException on Zebra TC but not on Google Pixel

// Expert user has replied.
J John Priest 3 months 3 weeks ago
76 5 0

Here's the error on the Zebra device TC when using A13 and A14:

java.lang.SecurityException: Need android.permission.BLUETOOTH_CONNECT permission for android.content.AttributionSource@f787829e: AdapterService getConnectionState

No problem with Google Pixel and any version

 

Manifest permissions:

   <uses-permission android:name="android.permission.BLUETOOTH_ADMIN" />
   <uses-permission android:name="android.permission.BLUETOOTH" />
   <uses-permission android:name="android.permission.BLUETOOTH_CONNECT" />
 

Please Register or Login to post a reply

5 Replies

E Edward Correia

Hi John. Thanks for using Zebra products. 

If you can, please explain briefly what you were trying to do when the error occurred. 

Several Zebra apps require the device user to manually grant certain permissions before normal operations are possible. 

Thanks, 
E.Correia

J John Priest

Hi. My apologies please for the insufficient information. This is a Bluetooth printing application, the framework of which I've used since before an SDK was available. The error is logged on socket.connect(). An AS example project here: https://zebra-my.sharepoint.com/:u:/p/qkjn37/EVZxBP258XRKuQu_mJbR5g8B_XneSkg3mX8q1RFIDmm5KA?e=72RABA

S Sandeep Hattiholi

Hi John,

As per Android developer guide, "android.permission.BLUETOOTH_CONNECT" is added from A12 as dangerous permissions and these are runtime permissions and needs to be handled by following below link.

https://developer.android.com/guide/topics/permissions/overview#runtime

Regards,

-Sandeep

J John Priest

Thanks Sandeep. I'm aware of the runtime permissions but I'm confused why my app runs without error on the Pixel. I lowered the minSdkVersion to 16 and no longer get the error on the TC so I'm good. My only concern now is if this is a TC problem or a Pixel problem. If it got me it'll get others.

J John Priest

Thanks Sandeep. I'm aware of the runtime permissions but I'm confused why my app runs without error on the Pixel. I lowered the minSdkVersion to 16 and no longer get the error on the TC so I'm good. My only concern now is if this is a TC problem or a Pixel problem. If it got me it'll get others.

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