Android Tutorial Android Serial tutorial

rvctx

New Member
Licensed User
Smartphones Bluetooth serial port

Hello,

is the B4A serial port library working with any smartphone running Android 2.2 or more ?

Best Regards,

Herve
 

AlpVir

Well-Known Member
Licensed User
Longtime User
Android 2.3.4 - Motorola Defy Plus - 32 GB - connected to PC via "Wi-Fi" and "B4A - Bridge"
0) install and open
1) connect menu
2) i choose the only device (external GPS antenna iBlue-747)
3) error: <Connection Error - Java.io.IOException: Device or resource busy>

Any Ideas ?
 

bluedude

Well-Known Member
Licensed User
Longtime User
Paired device

Hi,

My device is paired with my car bluetooth kit and when I step into my car (Audi) it automatically connects.

I was wondering if there is a way to monitor if it got connected when I enter my car. So I don't want to pair, connect etc. but basically just know when I'm in my car by monitoring to which device it connects.

Based on that information I can do a few cool things.

Cheers,
 

KY Leng

Active Member
Licensed User
Longtime User
Serial1.connect seem to response too slow

Hi Erel,

I have a bluetooth device using SPP (BT-SPP) and it is always ready for the connection with our phone. However, if I start using Serial1.connect
when the phone is not in the communication range with my BT-SPP,
the phone take about 20s to 1mn before telling us that it cannot connect to BT-SPP.

My question is:
1. How to cancel this connection before the serial'event raise?
or can we always cancel it with Serial1.diconnect?
2. How to shorten the response? I mean if our phone cannot connect to BT-SPP after 3s, we want to disconnect the BT...and then reconnect again. Normally, if the phone cannot fine the correspondant BT device in the range, it will keep searching in background and even we move in to the range, it still cannot connect proprely or cannot connect untill we reconnect it again.

All my questions are for : How to etablish a connection as fast as possible when the phone go into the corresponding BT range?

Looking forward to hearing from you soon, Erel.
 

Steven Goh

New Member
Licensed User
Longtime User
Serial reconnect error

Erel,

I just bought Basic4android and i am new. Downloaded the chat software and connects to my device (Bluetooth terminal) everything works fine.

The problem comes when i off the bluetooth device and the chat program jumps automaticly to "main" (AStream_Error)- which is correct.

I ON my bluetooth device and when i connect back again, it jumps to the chat page. When you try to chat (Send data to my bluetooth device), it will jump back again to "main" and pop up a "Connection is broken"... and it goes on and on.

It will only work fine again when i restart the chat application.

Is there a way to fix this? I am building a product base on bluetooth. Please help.
 
Last edited:

Steven Goh

New Member
Licensed User
Longtime User
Serial reconnect error

Problem solved.

Do it by using exitapplication - in which it actually kills the ChatActivity page but not the main. So application will automatically shows main.

Sub AStream_Error
ToastMessageShow("Connection is broken.", True)
ExitApplication
End Sub

Just to share
 

Steven Goh

New Member
Licensed User
Longtime User
Activity.Finish

Erel,

Thank you for your fast response. I am impressed with your great service. I have just changed to Activity.Finish.

Thanks again Erel.

Love Basic4android!! Its cool.
 
Last edited:

gawie007

Member
Licensed User
Longtime User
Bluetooth Pairing

Hi.
This all works quite well however I would like to pair devices and not have to scan for them again.

In Android developer you can query paired devices: Bluetooth | Android Developers

Is there a way to "getBondedDevices()" from the phone so that the devices can connect without having to be discoverable?

Kind regards

Gavin
 

gawie007

Member
Licensed User
Longtime User
I knew you were going to make it simple...
I was more concerned with Bluetooth and should have been looking at serial.
Apologies if I have wasted some of your time.
Thank you Erel!!!!!!!!
 

locxtronic

Member
Licensed User
Longtime User

im using this code to read the data. but my app crash and force close displayed.
 
Cookies are required to use this site. You must accept them to continue using the site. Learn more…