B4A-Bridge-Relay by 12Lab

App: B4A-Bridge-RelayB4A-Bridge-Relay-Free

Published: January 2014

Having 3 or more devices (or even 2!) on which to test an application in development is presently cumbersome from the B4A IDE (as of 3.2). I realized that a few changes to B4A-Bridge would save many iterations through the IDE. In a private communication with the principal, Erel Uziel, Anywhere Software approved derivative works based upon Anywhere Software posted source on the B4A/B4PPC forums. With B4A-Bridge-Relay, deploying an app to more than one device takes essentially no more time than it does with just one.


The existing B4A-Bridge (2.10) was refactored to separate the Service framework from the B4A-Service functionality, a new Class added for downstream connections, and packet counting was added to the apk deployment transfer, so progress can be monitored as necessary. You get confirmation that the transfer to the -Relay started, then you can turn your attention elsewhere. If you find yourself in a ‘poor’ WiFi environment, this will also save you some guessing. The ‘H’eartbeat indicator will also assist with this situation, and the colored status text makes it easy to tell at a glance. If you use B4A-Bridge-Relay on all client devices, you can observe the transfer to each device.

B4A-Bridge-Relay also displays additional Server information as compared to the standard B4A-Bridge. In WiFi mode, the port used is displayed after the IP address. In Bluetooth mode, the MAC Address and the Name are displayed. These identifiers are helpful in certain situations.


Short Press of the “Skip Clients” button will tell the Service to not use the application client list, Long Press will allow view/delete of clients from the application’s client list. “Use Clients” functionality is maintained; Short Press tells the Service to use the application’s client list, Long Press allows adding a new client to the application’s client list. Changes to the application client list are immediately applied to the Service list; however, after entering any desired clients, press F2 in the B4A IDE to force all clients to ‘connect’.

When adding a client address, you can now use a range or the ‘*’ wildcard in the last segment. will auto-populate clients .4,.5,.6,.7,.8. The end of the range can be left off, in which case it defaults to -254. If the wildcard is used, such as 192.168.2.* , then .2,.3,…,.253,.254 is auto-populated. If some of those IP addresses in the range do not actually have a real associated target device, that is fine; B4A-Bridge-Relay will just skip over them if the IDE-initiated connection attempt fails. Entering the device’s address as a client will be ignored, as will any duplicate client addresses; this also functions as a cancel operation.

The Status area shows the first few connected clients in the  client list. To see the full list, long-press on Skip Clients, scroll through it as needed, then cancel when finished.


At least some older phones (example, HTC WildFire running Android 2.3.5) may hang a port open; this can be identified by use of port 6906 when the WiFi service is started. The application displays “My IP: A.B.C.D:port” when Start-Wifi is pressed. Port is usually 6789, except when it isn’t available, and then it uses port 6906. Currently it is not possible to set the port for a client in the Relay application, it always uses the default of 6789.  Since the original B4A-Bridge is registered as a different application in Android, you may have one of them running holding the port open, and if its Service is running, the Relay (or the IDE) will connect to it on port 6789. Fix is to clear the in-use/hung port by either stopping the offending application/service, or rebooting the phone.


2014/09/12 v2.10.10: “-Free” updated with improved layout.

2014/07/27 v2.10.9: “-Free” updated with changed “Wake Lock” behavior; The lock is no longer released when the Activity is paused. Use the Exit button to release the lock and exit the application. This is to fix a Compile/Run deployment issue, the android may go to sleep when B4a-Bridge-Relay-Free is paused to switch to installation. If this is found acceptable by users it will be added to the paid version.

2014/06/29 v2.10.8: Added -Free version so there is no direct cost to try -Relay out.

2014/06/28 v2.10.7: Added “Wake Lock”, keep the device from sleeping, while UI is up.

2014/02/13 v2.10.6: Added Tablet friendly layout, connection ‘H’eartbeat indicator and colored status.

2014/02/10 v2.10.4-5: Enhancement; Bug Fixes. In some modes, such as Portrait, the Phone keyboard is used, to make it easier to enter addresses. Keyboard is now auto-displayed when adding a client. IP entry has validation. When IP address range and wildcard was added (v2.10.3), the ability to enter a standard IP address was broken. This is now fixed. 2.10.4 did not accept IP address segments with value of 0. Fixed.

2014/01/28 v2.10.3 Update: Added a new feature where a range or wildcard can be used in the last IP address segment when adding client(s). See above for more details on how this is entered.

2014/01/11 v2.10.2 Update: Testing of the BT server mode uncovered a bug that was preventing the BT mode from starting; instead it would start the Wifi mode. Issue has been corrected. An enhancement is also in this release: Server ID (identification) displayed continues to show the Wifi IP address for Wifi mode (displayed as IP:Port), but now displays the BT MAC and Name for BT mode.

2014/01/08 v2.10.1 Update: “Clear Clients” button in v2.10 not only removed the client list from the Service, it was also unintentionally clearing the application’s backing list of clients. The intention is to have the application maintain a list of clients, irregardless of whether the Service was actively using the list. Issue is corrected; the button is now relabeled as “Skip Clients”. Also, “Start-Wifi” was not starting the Service on the correct port, until “Stop” was pressed and “Start-Wifi” pressed again. Corrected.

2014/01/04 v2.10 Initial release: is based upon B4A-Bridge v2.10. Added Apk transfer packet counting/display. Added downstream clients. Wifi mode has been tested, Bluetooth functionality not changed. This version is made available to support multiple WiFi connected client devices.

Apk transfer ‘progress’ code addition is available at: http://www.basic4ppc.com/android/forum/threads/b4a-bridge-source-code.8153/page-2#post-212716. See page-1 post 18-20 for details on 2.09, 2.10.

Release Note is at: http://www.basic4ppc.com/android/forum/threads/b4a-bridge-relay-by-12lab-download-apk-from-b4a-ide-to-multiple-device-targets.36440/



SLIDcES is in a prototype phase. What is it? There’s a reason for a lowercase ‘c’ in there; this is a ‘slide’- like presentation package that uses DC.js internally. Thus, DC within SLIDES, or SLIDcES.

Here is an example created to visualize some auto leases offered in the Summer of 2014. Compare this to reading through paragraphs or even tables of data. Click on the image to see the sample and see how visualization can help with leasing comparisons.

See how DC.js can help with lease terms evaluation
See how DC.js can help with lease terms evaluation

So what is DC.js? Dimensional Charting roughly speaking is D3 + Crossfilter. Follow the links for more information about each library.

1. D3 is a js library that provides  capability to manipulate documents based on data, allowing visualizations that can come alive through the use of basic web technology (HTML, SVG and CSS) supported by modern browsers. The full name is Document Driven Data, or D3 for short.

+ 1. Crossfilter, also a js library, enables exploring large multivariate datasets in the browser.

= 2. DC: Dimensional Charting, while not an acronym for D3+Crossfilter, is exactly that: a simplified javascript software capability for data visualization and analysis in a browser, significantly reducing the learning curve to create a responsive interface to your data. It has performance tweaks such as caching built in, for fast response.

There are many public examples of the DC technology, one such is at Dancing Data* using coffee shop data. The D3 Gallery is full of charts that demonstrate a wide range of visualizations that could be created. Although DC.js presently has a limited subset implemented, it does meet basic charting requirements, and more.

Click on over to SLIDcES and start by trying out the Auto Leases sample, using real** data from July 2014. Check the Show Table checkbox in the upper left corner of the page in order to view the table of all or filtered data. Isn’t this a better way to compare lease offers, than reading through a table, many paragraphs, or multiple articles/websites of offers?

What does SLIDcES offer over DC.js? DC.js requires “web” coding – javascript, html, and css in order to create a working “visualization” page. SLIDcES allows you to select/choose your content without requiring coding. Pick your file or web URL, select data to display and choose the chart(s), and tailor the display to meet your visualization needs. Documentation on the Editor has not yet been created, although the editor is available in the example set. Check back here soon for a tutorial on creating a slide.

SLIDcES has a small footprint, a few hundred Kbytes. The files can be loaded from a CDN, or hosted locally, even within an Android App. The Google Play store has a sample app that loads the files from www.the12Lab.com – https://play.google.com/store/apps/details?id=com.the12Lab.wvd.SLIDcES

Note* The Dancing Data example does take quite some time to load, YMMV.

Note** ‘real’ here includes any errors in the original data, and any that may have been introduced creating this sample.