Tool BridgeCLI - Command line tool for B4A-Bridge

BridgeCLI is a command line B4A-Bridge manager written in B4J.

It allows developers to install release APKs through the command line.
You can use it to deploy applications on multiple devices.
It should work on Mac and Linux as well as Windows (It was only tested on Windows).

You should run B4A-Bridge v2.3+ on the devices.

It can use the auto discovery feature to find devices.
To list the discovered devices:
B4X:
java -jar BridgeCLI.jar -Discover
Output:
192.168.0.5 - LGE Nexus 5
192.168.0.9 - LGE Nexus 5X

The second supported feature is -Install. You need to pass the APK file and it will install it.
B4X:
java -jar BridgeCLI.jar -Install "C:\Users\H\Documents\B4A Samples\Objects\1.apk"
In this case it will install it on the first device found.
You can add -Ip to select the ip address (instead of auto discover):
B4X:
java -jar BridgeCLI.jar -Install "C:\Users\H\Documents\B4A Samples\Objects\1.apk" -Ip 192.168.0.5

You can add -Name to select one of the discovered devices:
B4X:
java -jar BridgeCLI.jar -Install "C:\Users\H\Documents\B4A Samples\Objects\1.apk" -Name "LGE Nexus 5X"

The B4J source code is attached.

Tips:

- Make sure that the device is not connected to the IDE with B4A-Bridge when using this tool. Otherwise the IDE will "steal" the connection and the transfer will be broken.
 

Attachments

  • BridgeCLI.jar
    140.6 KB · Views: 514
  • B4A-Bridge_CLI.zip
    4.1 KB · Views: 519
Last edited:

Erel

B4X founder
Staff member
Licensed User
Longtime User
How about implementing something like "-Install <apk file path> -all"?
I will add such a feature in the future.

For now you can create a batch file that sends to multiple ip addresses or a simple B4J program that calls Discover and then sends to all addresses.
 

Claudio Oliveira

Active Member
Licensed User
Longtime User
I will add such a feature in the future.

For now you can create a batch file that sends to multiple ip addresses or a simple B4J program that calls Discover and then sends to all addresses.

This should also work out fine.
Thanks Erel.
 

victormedranop

Well-Known Member
Licensed User
Longtime User
I will add such a feature in the future.

For now you can create a batch file that sends to multiple ip addresses or a simple B4J program that calls Discover and then sends to all addresses.

I'm waiting for that !!

amazing
 

LucaMs

Expert
Licensed User
Longtime User
Might be a firewall issue. Anyway you should write the explicit IP address instead...
Even disabling my firewall... nothing.

Using the IP it's ok.

I should study the source code (BTW I do not see, in the code, where (and how) the log of discovered devices should occur); surely the classic 192.168... is not mandatory, right?
 

LucaMs

Expert
Licensed User
Longtime User
surely the classic 192.168... is not mandatory, right?

B4X:
Private Sub Timer1_Tick
    Log("Broadcast Address: " & udpsocket.GetBroadcastAddress)
    Dim p As UDPPacket
    p.Initialize(Array As Byte(0), udpsocket.GetBroadcastAddress, port)
    udpsocket.Send(p)
End Sub
the log is:
Broadcast Address: 192.168.56.255

My lan does not start with 192.168
 

TelKel81

Active Member
Licensed User
Does this feature still work ? I get an "Error sending file" midway through the upload (as shown by the progress bar at bottom of my B4A-Bridge app)
 

TelKel81

Active Member
Licensed User
Thx Erel, the IDE was connected to the bridge, it worked as soon as I disconnected.
 
Top