3
votes

What I want to do :

I'm developping an Android specific app where I must pair a device automatically, without even displaying the usual dialog box to ask the user to input a passcode.

My code is mainly inspired from these two stackOverflow Threads :

Auto-accept bluetooth pairing possible?

Programmatically pairing with a BLE device on Android 4.4+

The problem I'm facing :

  • device #1 on android 5.1.1 : Ok
  • device #2 on android 6.0 : Ok
  • device #3 on android 5.1 : couldn't pair because of an incorrect pin or passkey
  • device #4 on android 5.1 : couldn't pair because of an incorrect pin or passkey

I can't tell if android version has something to do with this issue. Do you have any idea that may help me make it work on devices #3 and #4 ?

1
could you provide device list also?Siarhei
What kind of devices do you want to pair with? Is it some custom hardware or is it other smartphones?Emil
Which role does device play? Is it central, and phone is peripheral?anticafe
Thank you all for your answers. By "device", I mean a "no-brand Android tablet". I do not work with these anymore, and I'm not facing this problem. I do not have a solution for this, I'm sorry.Ariles

1 Answers

0
votes

I was also getting the same issue, that my BT code was working fine on other versions but failing on 5.1 & 5.1.1.

But then I tried Android-BluetoothSPPLibrary, which worked on android 5.1 & 5.1.1.

So, try this and review his code, which might give you a clue about what you are doing wrong.