Android Tutorial B4A-Bridge source code

B4A-Bridge is made of two components. One component is running on the device and the other is embedded in the IDE.
The device side is the server side. It waits for connections and when a connection is established it handles the "action" messages.

The code itself is made of a simple activity:

arSsfzqjKtq2_v9Moofj4SgiWWet6WOFH-P1Z2NuxbMo4yB6yqsGaoioptbDdbMCZw4=h900



And a service that is doing most of the job.
All the network communication is handled by an AsyncStreams object. AsyncStreams are very useful for networking and other external communication.

In this case the AsyncStreams object is initialized in prefix mode. In this mode we always receive complete messages which makes things simpler.
See this tutorial for more information: AsyncStreams Tutorial

This code is a good example for networking and working with service.
You are welcomed to examine the code and ask any question about it.

Latest version source code is attached.
 

Attachments

  • B4A-Bridge-source.zip
    29.5 KB · Views: 708
Last edited:

metrick

Active Member
Licensed User
Longtime User
Erel:
Thank you.
Can you also provide the code for IDE Tools->B4A Bridge->Connect and Disconnect? Would like to know how it all ties together. Thanks.
 

Erel

B4X founder
Staff member
Licensed User
Longtime User

joedarock

Member
Licensed User
Longtime User
I'm running Bridge Ver 2.00 and B4A Ver 1.9. When I attempt to connect via the Bluetooth bridge, the IDE hangs up and can only be reset by Task Manager. My phone (Droid Incredible 2) is paired to the PC's Bluetooth modem and that pairing works for other apps I've written.

Suggestions??
Joe
 

manios

Active Member
Licensed User
Longtime User
IDE may lock up

Erel,
I am running B4A Ver 1.9. I do not have any Bluetooth device on my PC.
Yesterday I hit accidently Connect Bluetooth and the IDE did lock up. Had to kill the application with the task manager. Unfortunately I lost some code I was working on.
Would it be possible to deselect the menuitem for Bluetooth?
 

alvinmb

Member
Licensed User
Longtime User
Bridge issue in 1.9 Bluetooth hands IDE

I'm having major issues with the IDE and using the Bluetooth bridge.
I establish a connection with the device and IDE, compile and the new package gets delivered to the phone, at which point the compile message box will not allow me to use the close button, and the IDE locks up. The only way out is to use task manager to kill the IDE.
 

Jondroid

Member
Licensed User
Longtime User
Hi Erel,
thanks for the updated version of the bridge. The version which I installed from the market is version 2.01 but the source code above is version 2.00 according to the source code.

What are the differences between 2.01 and 2.00?

Many thanks in advance,
Jondroid
 

reijndert

Member
Licensed User
Longtime User
b4a bridge

Hi Eril.
Can you put the most recent b4a source in the thread.
I want to recompile because of my ics-style ROM (BroodKernel and BroodROM) on my 2.3.6 android phone.
Dark thema and getting black text on darkgrey buttons...

I tried modifying this but i ended up with a 2.00 version.

Thanks in advance.
 

Attachments

  • SC20120830-132233.png
    SC20120830-132233.png
    34.7 KB · Views: 1,260
Top