Tool BridgeCLI - Command line tool for B4A-Bridge

Discussion in 'Additional libraries, classes and official updates' started by Erel, Feb 23, 2017.

  1. Erel

    Erel Administrator Staff Member Licensed User

    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:
    Code:
    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.
    Code:
    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):
    Code:
    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:
    Code:
    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.
     

    Attached Files:

    Last edited: Mar 14, 2017
    ahorro1, JordiCP, Pendrush and 12 others like this.
  2. Claudio Oliveira

    Claudio Oliveira Active Member Licensed User

    Awsome!
    How about implementing something like "-Install <apk file path> -all"?
    This would have the apk installed on all discovered devices, one at a time....
     
    victormedranop and fireday like this.
  3. Erel

    Erel Administrator Staff Member Licensed 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.
     
    fireday and Claudio Oliveira like this.
  4. Claudio Oliveira

    Claudio Oliveira Active Member Licensed User

    This should also work out fine.
    Thanks Erel.
     
  5. victormedranop

    victormedranop Well-Known Member Licensed User

    I'm waiting for that !!

    amazing
     
  6. Erel

    Erel Administrator Staff Member Licensed User

    I'm waiting for the following feedback from users who test it with multiple devices: do you see all the devices listed when you run
    Code:
    java -jar BridgeCLI.jar -Discover
    ?
     
  7. LucaMs

    LucaMs Expert Licensed User

    None.
    I have 2 devices (Android 4.4.2 and 7.0) with Bridge 2.54 running
     
  8. Erel

    Erel Administrator Staff Member Licensed User

    Do you see the red heart in B4A-Bridge on these devices?
     
  9. LucaMs

    LucaMs Expert Licensed User

    No (in this case, of course; usually, connected to the IDE, yes).
     
  10. Erel

    Erel Administrator Staff Member Licensed User

    Might be a firewall issue. Anyway you should write the explicit IP address instead...
     
  11. LucaMs

    LucaMs Expert Licensed User

    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?
     
  12. LucaMs

    LucaMs Expert Licensed User

    Log($"${DeviceIp} - ${DeviceName}"$)
    :D
     
  13. LucaMs

    LucaMs Expert Licensed User

    Code:
    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
     
  14. LucaMs

    LucaMs Expert Licensed User

    Setting directly "my host" - xxx.xxx.xxx.255, instead of "udpsocket.GetBroadcastAddress" it founds the devices.

    (I found somewhere that a problem exists with GetBroadcastAddress and Windows 7).
     
Loading...
  1. This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
    By continuing to use this site, you are consenting to our use of cookies.
    Dismiss Notice