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. 192.168.2.4-8 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.