Android Tutorial B4A-Bridge a new way to connect to your device

Discussion in 'Tutorials & Examples' started by Erel, Feb 24, 2011.

Thread Status:
Not open for further replies.
  1. erosmax

    erosmax Well-Known Member Licensed User

    I've only just added iinto Manifest the code with have found in B4A forum and add the startactivity isgame = true for insert into a game screen on TV (for your app have set = false). ;)
    This is the complete code of my Manifest:

    Code:
    'This code will be applied to the manifest file during compilation.
    'You do not need to modify it in most cases.
    'See this link for for more information: http://www.basic4ppc.com/forum/showthread.php?p=78136
    AddManifestText(
    <uses-sdk android:minSdkVersion=
    "5" android:targetSdkVersion="20"/>
    <supports-screens android:largeScreens=
    "true"
        android:normalScreens=
    "true"
        android:smallScreens=
    "true"
        android:anyDensity=
    "true"/>)
    SetApplicationAttribute(android:icon, 
    "@drawable/icon")
    SetApplicationAttribute(android:
    label"$LABEL$")
    'End of default text.

    ' TV Settings
    SetApplicationAttribute(android:isGame, "false")   'true to insert into GAME screen
    AddManifestText(<uses-feature android:name="android.software.leanback"
                                  android:required=
    "false" />       
                    <uses-feature android:name=
    "android.hardware.touchscreen"
                                  android:required=
    "false" />)
    AddActivityText(TvActivity,
                    <
    intent-filter>
                    <action android:name=
    "android.intent.action.MAIN" />
                    <category android:name=
    "android.intent.category.LEANBACK_LAUNCHER" />
                    </
    intent-filter>)
    'END TV SETTING


    AddManifestText(<uses-feature android:name=
    "android.hardware.bluetooth" android:required="false"/>)
    AddManifestText(<uses-feature android:name=
    "android.hardware.touchscreen" android:required="false"/>)
     
    Erel likes this.
  2. B4AinNY

    B4AinNY Member Licensed User

    I have not been able to successfully connect via WiFi - I enter the IP address from B4A Bridge into the Tools / Connect / IP address
    but it always reports that it can't find the device.
    My Tools Connect does not seem to give me BlueTooth option
    I am using B4A in Demo mode ( I don't mind paying $50 - well worth it ) but I'd like to make sure the thing works.
    Is B4A Bridge functioning in demo mode ?
     
  3. Erel

    Erel Administrator Staff Member Licensed User

    B4A-Bridge does work in the trial version.

    Is the Android device connected to the same local network as the PC?

    What is its IP address?
     
  4. B4AinNY

    B4AinNY Member Licensed User

    OK - Trial or otherwise, I ordered a license just in case.
    It still doesn't work.
    My Android is connected to WiFi through a router on the same network as the PC.
    My Android's IP Address is currently 192.168.1.100
    The B4A Bridge on the Android says
    Status: Disconnected
    Waiting for wireless connections
    When I try to connect through B4A Tools / Connect / menu
    I get error
    Ping failed ( IP = 192.168.1.100 ): Timed Out
    The IP Address is most probably incorrect.

    Note - I have also bought a USB to Bluetooth for my computer
    and have verified a Bluetooth connection between computer and
    my Android but B4A doesn't seem to recognize this.

    Note - I have also tried direct USB connection from computer to my
    Android and I can drag files using FileManager, but apparently B4A
    still doesn't recognize this connection either.

    - Jeff
     
  5. Erel

    Erel Administrator Staff Member Licensed User

    It looks like a network issue. Maybe your router is configured to block incoming connections.

    Anyway, you should use USB debug mode instead.

    This is not USB debug mode. In order to enable USB debug mode you need to install the USB driver and enable USB debug mode on your device (see the first post).

    On most devices you also need to change the USB connection mode from "charge" to PTP.
     
  6. B4AinNY

    B4AinNY Member Licensed User

    I never could get the B4A Wifi connection to work,
    but I thought I'd post back that USB connection has been working well.
    I bought B4A license back in May and have been very happy with it.

    - Jeff / B4AinNY
     
  7. Erel

    Erel Administrator Staff Member Licensed User

    fireday, DonManfred, jmon and 14 others like this.
  8. hibrid0

    hibrid0 Active Member Licensed User

  9. Enrique Gonzalez R

    Enrique Gonzalez R Well-Known Member Licensed User

    i just tried b4J-bridge and it already comes with FTP! that is so awesome!
     
  10. victormedranop

    victormedranop Active Member Licensed User

    Hi, I just made a update to version 2.20, but not log display from my apk.

    any one have the same problem?

    I try to connect with adb an logs are working, but no with the b4x_bridge.

    Victor
     
    Last edited: Jan 15, 2017
  11. Erel

    Erel Administrator Staff Member Licensed User

    Logs will only work in debug mode with B4A-Bridge.
     
  12. Bob Spielen

    Bob Spielen Active Member Licensed User

    Hello, I'm trying to enable the logs, but without success. I receive a message :

    "LogCat connected to: B4A-Bridge:asus ASUS_X008D
    ------ beginning of main"

    and nothing else .....

    I configured my android as developer (7x click on build number), enabled installation of "Unknown sources", debug mode.....
    Can any one give me some advice?

    I checked if logs were disabled on my device. Turned on and logs worked....
     
    Last edited: Feb 7, 2017
  13. Erel

    Erel Administrator Staff Member Licensed User

    For now you will need to switch to USB debug mode.

    B4A-Bridge logs implementation was rewritten and the logs will work better in the next version of B4A.
     
  14. Bob Spielen

    Bob Spielen Active Member Licensed User

    Ok! Thanks a lot Erel for the fast reply.
     
  15. B4AinNY

    B4AinNY Member Licensed User

    I fi
    I finally got B4A Bridge WiFi working and thought I should post back my resolution.
    Basically I switched from a WiFi router on a LAN to a mobile hotspot device and connected both my tablet and the PC to that. Still no good. Very frustrated I installed today's B4a v 6.80 and B4aBridge v2.30 sure this would fix it. Still no good. Very very frustrated.
    Then I had the bright idea finally to try TraceRt to the tablet from my PC and sure enough that failed
    even though both were connected to the same WiFi device. This lead me to find a setting in my
    Wi-Fi hotspot that was isolating the each device connected to the route. On the Verizon Ellipsis
    this is called "Privacy Setting" another name on other devices appears to be "AP Isolation"
    This setting needs to be OFF !, That's it. Voila !
    I hope this is helpful to others.

    - Jeff
     
  16. Petri Savolainen

    Petri Savolainen New Member Licensed User

    Hi,

    I am in a situation where i have to do development in a virtual Machine running on Azure.
    I cannot run the emulators on azure (no hyper-v stuff). I tried to do the USB-port sharing from local to vm .... did not work.

    The bridge would be the perfect solution if it didn't require the dev machine and phone to be in same network.
    I tried using ngrok and some putty port forwarding but that didn't work .

    any ideas ?

    petri.
     
  17. Martin Larsen

    Martin Larsen Active Member Licensed User

    Port forwarding should work though I haven't tried. Or perhaps vpn?
     
  18. Petri Savolainen

    Petri Savolainen New Member Licensed User

    Thanks, Martin.

    I read from somewhere that the port used by b4a-bridge is 6789.
    So I installed putty on the vm and forwarded the port 6789 to the address i got from ngrok where I had set up a tcp tunneling to my local pc port 6789. and from my local pc I had putty from 6789 to my phone's ip and 6789 port.

    ngrok shows console whenever there's traffic and when I tried to reach the public endpoint of my ngrok-realy it showed that something was going on.
    But when I tried to connect b4a-bridge in the Virtual machine it should have talked to the same public endpoint but there was no traffic to be seen... as if putty didn't work or b4a-ide wasn't really talking to 127.0.0.1:6789 ...

    So I gave up, bought an extra disk and installed the bloody android sdk there (all 300 G's of it) and hooked it up to my work pc.
    Now I have both pc and the phone on same network. And it actually works really nicely.
    The wysiwyg-view is really impressive. Now I can concentrate on coding instead of wrestling the infrastructure .

    As an extra punishment i have to drag the external hd and some usb-gadgets with me all the time to make this happen but I think the functionality is worth it.

    petri.
     
  19. DeSche

    DeSche New Member Licensed User

    Hi Erel,

    I haven't used B4A for some months due to other priorities. Now I'm on vacation, it's raining and I have some Time :)
    I've figured out, that B4A-BridgePlus is not working with B4A v6.80 any more. Therefore I've installed B4A-Bridge v2.31. No Problems with the wifi Connection.
    But...the developed apk will not be installed on my Samsung S6, even when the the Debug-Window says in the last sentence: "Installing with B4A-Bridge....successfully...."
    I also can find a 'temp1.apk' with Correct time and date in /Android/Data/anywheresoftware.b4a.b4abridge/files so I assume, that something on my phone let the apk not install. Any ideas?
    As mentioned before, the same project works on the same hardware very well two months ago.
    I have Android 7.0 on my phone.

    Edit 170628-1524: When I enable USB Debug Mode on my S6 and connect it via USB cable to my V4A Laptop, than the apk get installed. Therefore my assumtion is, that something with the v2.31 B4A-Bridge does not work as designed.
     
    Last edited: Jun 28, 2017
  20. Erel

    Erel Administrator Staff Member Licensed User

    Do you see any error message on the device?

    Have you tried to uninstall the existing app?
     
Thread Status:
Not open for further replies.
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