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:
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.
Source code: https://github.com/AnywhereSoftware/B4A-Bridge
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:
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.
Source code: https://github.com/AnywhereSoftware/B4A-Bridge
Last edited: