Android Question blutooth pairing problem

Hello evryone,

i am now working on app in B4A ,that in my app there is a blutooth connection section,i now researching about blutooth connetion,recently i read a post in this link that there were a project in this subject but when i press scan button in app, start searching nearby bluetooth,it found devices correctly ,when i click on any founded devices,start connecting to that,but no reciving pairing request or any password requiring section and connecting fail and apear Erorr connecting.

Apeared Erorr is:
Erorr faild,socket might closed or timeout,read ret:-1

Note:I want a code that like this app search and connet to any blutooth devices that user select it after found.

whats your view about this problem?
how can i solve it?
where of code is not correct?

sincerely yours.


    12.4 KB · Views: 188
  • IMG_20200426_124457.jpg
    15.3 KB · Views: 194
  • IMG_20200426_124441.jpg
    13.5 KB · Views: 181
  • IMG_20200426_124422.jpg
    17.3 KB · Views: 169
Last edited:


B4X founder
Staff member
Licensed User
Longtime User
as discussion in post even i add start service BTPair and manifest change,as erel said.but any pairing request or passsword requre not apear and app show erorr like attached picturs erorr .
This discussion is not relevant.

Erorr faild,socket might closed or timeout,read ret:-1
You can only connect to a device that is listening for connections. Run the chat example on the two devices.
Upvote 0
so thanks Erel, but i want to connect to selected found bluetooth device ,that include pairing request like usual connecting to other bluetooth.

so, how can i change the code?
Upvote 0


Well-Known Member
Licensed User
Longtime User
what is reason of this Erorr?
how i can solve this Erorr?
I work with lot of obd2 Bluetooth device. You can get that error message with a defective bluetooth device, device not powered up while connecting or maybe using wrong com port (if applicable).
Upvote 0
No,i can Connect to any bluetooth device from usual way in bluetooth settings and i see pairing request or pin and i can pair and unpair, but if i use this B4A app, it can find nearby devices but when i select device,connection faild Error apear.and do not receive any pairing request.
Upvote 0
The error in the first post is related to the other device not listening for SPP connections.

When we connect from Bluetooth settings, pairing request can this also a type of spp connection?

if answer is yes, why in way if B4A app it doesn't work?

if answer is no, so how i make a app that work like bluetooth setings connection?
Upvote 0