Android Question Device unavailable in Android Bluetooth / BluetoothAdmin Tutorial

howard bassen

Member
Licensed User
Longtime User
I am running the example for Bluetooth connectivity between two android devices:
https://www.b4x.com/android/forum/threads/android-bluetooth-bluetoothadmin-tutorial.14768

First I compiled program on my primary phone (ZTE Z981) and communicated with my PC (via its Bluetooth) . I can communicate both ways with a PC terminal emulator.

When I try to connect my primary phone to a second (PAIRED) android device rather than the PC I get I see the GUI on the device but get the following errors when I try to send or receive:

Logger connected to: ZTE Z981
--------- beginning of main
Nexus 7:08:60:6E:9D:87:70
:17:8D:84:76:1D:02
:08:66:98:B7:7B:D9
:08:66:98:B7:7B:D9
:08:66:98:B7:7B:D9
connected: false
java.io.IOException: read failed, socket might closed or timeout, read ret: -1
** Activity (main) Pause, UserClosed = false **

Can anyone suggest a fix
 

howard bassen

Member
Licensed User
Longtime User
Is the other device listening for connections?

When I use a commercial BT terminal app on my phone it works well with my PC (running a terminal emulator).

For the B4A app I can connect to my PC with the B4A example with difficulty. However the B4A app looses a connection when I try to send characters to the PC.
 
Upvote 0

howard bassen

Member
Licensed User
Longtime User
Unfortunately I do not see how I can incorporate the various pieces of code into the B4A Bluetooth example to fix my problem. Which pieces of code from the Asysnc Streams need to be added to the Bluetooth example, and where?
 
Upvote 0

howard bassen

Member
Licensed User
Longtime User
sorry but the example program has neither AsyncStreams, Astreams, or InitializePrefix. Should I add these subs from another example? if so, which and how?
 
Upvote 0

Erel

B4X founder
Staff member
Licensed User
Longtime User
?

SS-2018-01-07_09.20.59.png
 
Upvote 0
Top