Android Question Cant get Bluetooth chat example to work

Justin1234

Member
Licensed User
Longtime User
Hi,

First off im quite new at basic4android so I could be making a simple mistake but...
Ive been trying for days now and theres no way I can get the Bluetooth chat example to work. Neither the serial or asyncstream one works.
I either get service discovery error when the code is unedited or when I change to connectinsecure or connect2,3 I get connection refused.
Im trying to get it to work between a galaxy s3 and a Samsung tab3. Ive tried downloading a Bluetooth chat app from the play store and that works fine.

I need to send commands from one device to another so I figured this example would be suitable.
Thanks
 

Justin1234

Member
Licensed User
Longtime User
I either get service discovery error or connection refused. Curiously I tried the walkie talkie example and that worked flawlessly. So I modified the chat app to connect2 using the same uuid as the walkie talkie example. It then connected fine but the send and receive wasn't working properly.

I then later discovered that the modified chat app will only work after the walkie talkie example has been run.

So im currently trying to modify the walkie talkie app to send text rather than audio.

What I want at this point is you push a button on 1 phone and it sends a string. Phone 2 then displays the string
 
Upvote 0

stephankuba

Member
Licensed User
Longtime User
use this admin tutorial http://www.b4x.com/android/forum/threads/android-bluetooth-bluetoothadmin-tutorial.14768/
I had the same problem, if i do it with admin then it works.
There is a mistake in the project zip file you must change this


B4X:
AStream.Initialize(Main.Serial1.InputStream, Main.Serial1.OutputStream, "AStreams")

Sub AStreams_NewData (Buffer() As Byte)
  LogMessage("You", BytesToString(Buffer, 0, Buffer.Length, "UTF8"))
End Sub

then it works.

maybe this helps you.
 
Upvote 0
Top