3

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 ?

Community
  • 1
  • 1
Ariles
  • 333
  • 1
  • 14
  • could you provide device list also? – Siarhei Dec 15 '16 at 07:58
  • 1
    What kind of devices do you want to pair with? Is it some custom hardware or is it other smartphones? – Emil May 25 '17 at 19:12
  • Which role does device play? Is it central, and phone is peripheral? – anticafe Feb 01 '18 at 08:24
  • 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 Feb 27 '18 at 14:47

1 Answers1

0

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.

Arsalan Mehmood
  • 1,432
  • 1
  • 15
  • 26