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 https://www.b4x.com/android/forum/threads/android-bluetooth-bluetoothadmin-tutorial.14768/ 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 connecting:java.io.ioeexception:read 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.
 

Attachments

  • Bluetooth.zip
    12.4 KB · Views: 257
  • IMG_20200426_124457.jpg
    IMG_20200426_124457.jpg
    15.3 KB · Views: 251
  • IMG_20200426_124441.jpg
    IMG_20200426_124441.jpg
    13.5 KB · Views: 232
  • IMG_20200426_124422.jpg
    IMG_20200426_124422.jpg
    17.3 KB · Views: 228
Last edited:

Erel

B4X founder
Staff member
Licensed User
Longtime User
as discussion in post https://www.b4x.com/android/forum/threads/hidden-bluetooth-pairing-notification.79196/#post-730617 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 connecting:java.io.ioeexception:read 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

Scantech

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 apear.is 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
Top