Android Tutorial B4A-Bridge source code

Discussion in 'Tutorials & Examples' started by Erel, Mar 8, 2011.

  1. Erel

    Erel Administrator Staff Member Licensed User

    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:

    [​IMG]


    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.

    Latest version source code is attached.
     

    Attached Files:

    Last edited: Dec 22, 2016
  2. metrick

    metrick Active Member Licensed User

    Erel:
    Thank you.
    Can you also provide the code for IDE Tools->B4A Bridge->Connect and Disconnect? Would like to know how it all ties together. Thanks.
     
  3. Erel

    Erel Administrator Staff Member Licensed User

  4. Erel

    Erel Administrator Staff Member Licensed User

    Code in first post updated to B4A-Bridge v2.0.
     
  5. joedarock

    joedarock Member Licensed User

    I'm running Bridge Ver 2.00 and B4A Ver 1.9. When I attempt to connect via the Bluetooth bridge, the IDE hangs up and can only be reset by Task Manager. My phone (Droid Incredible 2) is paired to the PC's Bluetooth modem and that pairing works for other apps I've written.

    Suggestions??
    Joe
     
  6. manios

    manios Active Member Licensed User

    IDE may lock up

    Erel,
    I am running B4A Ver 1.9. I do not have any Bluetooth device on my PC.
    Yesterday I hit accidently Connect Bluetooth and the IDE did lock up. Had to kill the application with the task manager. Unfortunately I lost some code I was working on.
    Would it be possible to deselect the menuitem for Bluetooth?
     
  7. Erel

    Erel Administrator Staff Member Licensed User

    The interaction with the Bluetooth driver is done by a third party library. It is not expected to hang the IDE. Even if there is no Bluetooth device available. We will further investigate this issue.
     
  8. alvinmb

    alvinmb Member Licensed User

    Bridge issue in 1.9 Bluetooth hands IDE

    I'm having major issues with the IDE and using the Bluetooth bridge.
    I establish a connection with the device and IDE, compile and the new package gets delivered to the phone, at which point the compile message box will not allow me to use the close button, and the IDE locks up. The only way out is to use task manager to kill the IDE.
     
  9. Jondroid

    Jondroid Member Licensed User

    Hi Erel,
    thanks for the updated version of the bridge. The version which I installed from the market is version 2.01 but the source code above is version 2.00 according to the source code.

    What are the differences between 2.01 and 2.00?

    Many thanks in advance,
    Jondroid
     
  10. Erel

    Erel Administrator Staff Member Licensed User

    The only difference is that version 2.01 was compiled with the updated Network library (which fixes an issue related to wifi IP addresses).
     
  11. Jondroid

    Jondroid Member Licensed User

    Okay. Thanks Erel.
     
  12. reijndert

    reijndert Member Licensed User

    b4a bridge

    Hi Eril.
    Can you put the most recent b4a source in the thread.
    I want to recompile because of my ics-style ROM (BroodKernel and BroodROM) on my 2.3.6 android phone.
    Dark thema and getting black text on darkgrey buttons...

    I tried modifying this but i ended up with a 2.00 version.

    Thanks in advance.
     

    Attached Files:

  13. Erel

    Erel Administrator Staff Member Licensed User

    The latest version is now available in the first post.
     
  14. reijndert

    reijndert Member Licensed User

    Thanks.
    Could you replace it by 2.07?
    Thanks in advance.
     
  15. Erel

    Erel Administrator Staff Member Licensed User

    Done (v2.08).
     
  16. mr23

    mr23 Active Member Licensed User

    2.08 (and possibly earlier) requires ByteConverter. Drop into the Library folder, and check in the Libs tab.
     
  17. mr23

    mr23 Active Member Licensed User

    Erel, can you update the thread's zip with 2.09?
     
  18. Erel

    Erel Administrator Staff Member Licensed User

    Done. The version is actually v2.10 as it includes a small fix that was not included in v2.09 (in the manifest editor).
     
  19. mr23

    mr23 Active Member Licensed User

    b4a has:
    #VersionCode: 9
    #VersionName: 2.09
    Dim version As String = "2.10"
    Manifest has:
    android:versionCode="9"
    android:versionName="2.09"

    Intentional?
     
  20. Erel

    Erel Administrator Staff Member Licensed User

    It will be updated when v2.10 is released to Google Play.
     
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