Android Tutorial Android Serial tutorial

eshaulx

New Member
Licensed User
Longtime User
Not receving any data

Dear Basic4Android guys,

I'm trying to receive a communication from a bluetooth device that I have built.
The communication it's sending is: chr(170) which is "AA" every second.
I used this tutorial, I managed to find the device, but I did not receive any data from it. quick debugging turning out that TextReader1.Ready is never ready.

What am i missing in order to receive the data?
I'm not attaching any code because i am using your tutorial code as is.

Best,
Erez.
 

wm.chatman

Well-Known Member
Licensed User
Longtime User
Dir Erel

I have been reading and working with the Android Serial tutorial. I am a bit slow at understanding how this could be used, to gain access to external Gps.
Is it possible for you to help with a example for connecting to a external Gps Android Serial tutorial using the Asnyc Streams please. :sign0085:

The Samsung galaxy SII works great with a external BT device. No problems there at all.

Thank you much Erel
Best regards
William
 

wm.chatman

Well-Known Member
Licensed User
Longtime User
Thank you Erel for your lightning support.

Are you talking about this section?

Sub Activity_Create(FirstTime As Boolean)
Activity.LoadLayout("2")
If AStream.IsInitialized = False Then
AStream.InitializePrefix(Main.serial1.InputStream, True, Main.serial1.OutputStream, "AStream")
End If
txtLog.Width = 100%x
End Sub

Change the InitializePrefix to Initialize? I dont get it Erel :-(
 
Last edited:

wm.chatman

Well-Known Member
Licensed User
Longtime User
OK Erel, hate to bug you again. I am trying to get this to work.

Sub Activity_Create(FirstTime As Boolean)
Activity.LoadLayout("2")
If AStream.IsInitialized = False Then
'AStream.InitializePrefix(Main.serial1.InputStream, True, Main.serial1.OutputStream, "AStream")
AStream.Initialize(In As java.io.InputStream,Out As java.iutputStream, Eventname As String)
End If
txtLog.Width = 100%x
End Sub

at this time it gives me a error msg compiling, I know I am missing something.?

What I do not understand is this.
The Output Stream that is used for writing data. Pass Null if you only want to read with this object.?
What's up with the Pass Null?
We are only reading with this object, and not writing. So, what did I not do right here? Please let me know.

@ Erel. please forgive me, Please do not post questions in this sub-forum. < I missed this. Feel free to move post.
 
Last edited:

wm.chatman

Well-Known Member
Licensed User
Longtime User
By Gosch... I got it. and sure work's now.
It took some time to check this out, but some times thing's go slow and other times faster then usual.
That's how it is, if you work on four things at once.

> AStream.Initialize(Main.Serial1.InputStream, Main.Serial1.OutputStream, "AStream") <

Sorry I had also postet here a few Questions.
@ Erel > Thank you for your help and not getting teed at me.

Now to the next step. Oh, if need be, do move this Thread into the right area.

But also I see the You, You, You with the sentances.?

Best regards to all.
William
 

benkly

New Member
Licensed User
Longtime User
Hello,

I only need to send some decimal numbers without any control signs to a bluetooth device. Would this be possible?
And something I don't get out of the example code, if I build up a connection to a BT device, in this case a BT-to-Serial device, where do I change the COM specific things like the BAUD rate and so on?

Regards, Benny.
 

raphaelcno

Active Member
Licensed User
Longtime User
Hello,
And something I don't get out of the example code, if I build up a connection to a BT device, in this case a BT-to-Serial device, where do I change the COM specific things like the BAUD rate and so on?

You don't have to specify COM settings for the Bluetooth connection itself. The COM settings apply only to the serial connection (DB9 port), and you change them by connecting the BT/Serial device to a PC with terminal software.
 

SergioAntunes

Member
Licensed User
Longtime User
I tried the serial example App with the following:
1. Windows 7 64 running a copy of Real Term,
2. Compiled the Bluetooth.b4a app to a Samsung SCH-1500 cell phone,

I am able to send characters from the Samsung to Realterm on Windows however, when I send any thing from Realterm to the Samsung Bluetooth.b4a terminates.

Any suggestions where I should look for the problem. My guess is that it has something to do with the Bluetooth driver under Windows 7?

Notes:
1. I connect with B4A bridge over Bluetooth without any issues,
2. I can transfer files in both direction over Bluetooth.

Thanks
 

SergioAntunes

Member
Licensed User
Longtime User
Connecting to a Bluetooth serial adapter from an Android 4.0.3 Galaxy II.

I developed an App using the Serial library that talked to a device over Bluetooth. The App was running OK on a Samsung SCH1500 cell phone (with Android version 2.3.5. The Bluetooth to Serial adapter I used was from USConverters model UCBT232B.

I just purchased a Samsung Galaxy II pad with Android 4.0.3. Download B4A-Bridge and installed my App. The problem I have is that when I attempt the serial.connect I keep on getting the screen to enter the pin number as if the Bluetooth device was not paired. I did pair the device prior running the App.

I am trying to look at the log files.

Any ideas?

Thanks.
 

SergioAntunes

Member
Licensed User
Longtime User
Do you see the device in the paired devices list? Does it show when you call GetPairedDevices?

Yes the device appears on the list.

The problem might be in the adapter. Maybe you need to reset it somehow before pairing with a new device.

I have reset the device a couple of times. When running on the phone when the app tries to connect it displays the PIN screen and accepts the pin when entered. On the new Galaxy, it takes the PIN but fails to connect.
 

Similar Threads

  • Locked
  • Article
Android Tutorial Android JSON tutorial
Replies
90
Views
159K
  • Locked
  • Article
Android Tutorial SQL tutorial
Replies
161
Views
278K
  • Locked
  • Article
Android Tutorial GPS tutorial
Replies
310
Views
256K
Cookies are required to use this site. You must accept them to continue using the site. Learn more…