B4A Library Simple WIFI library

Discussion in 'Additional libraries, classes and official updates' started by HotShoe, Mar 8, 2014.

  1. FrankBerra

    FrankBerra Active Member Licensed User

    Any news about the error reported some days ago?
     
  2. HotShoe

    HotShoe Well-Known Member Licensed User

    Version 2.15 is mow attached to the first post. It fixes the null pointer error if wifi is turned off during a scan.

    --- Jem
     
    FrankBerra and Erel like this.
  3. FrankBerra

    FrankBerra Active Member Licensed User

    Great!!
    I tested it and now it seems working perfectly!
    Good job Jem!
     
  4. FabioG

    FabioG Active Member Licensed User

    Thanks!
    can add an function to disconnect the phone to the WiFi Network ?

    Thanks
     
  5. HotShoe

    HotShoe Well-Known Member Licensed User

    There is a Disconnect method, is it not working for you?

    --- Jem
     
  6. welu1805

    welu1805 Active Member Licensed User

    Hi all,

    I tried the example from HotShoe in mlwifi-2.15.zip. If there is a new Wifi AP (e.g. "Musikus") it is shown in the listbox without "Saved". This is correct because there is no password stored yet.

    I click at the item "Musikus" press OK to connect and enter the correct password. After OK I get "Could not connect to Musikus"

    I think the problem is with a not "Saved" AP the command scan.AddAP() is used. Here can I put also the password. But the problem is that an AP with the same Name is already in the Wifi-Manager. It should not be possible to add a new AP with the same name.

    To bypass this problem it should be able to put the password for "Musikus" to the AP and store it. During the next scan.StartScan or scan.UpdateWifiList this AP would have the attribute "Saved" and I could use scan.ConnectToAP. This should work.

    Has anyone an idea?

    Thanks
    Lutz
     
    Last edited: Jan 26, 2016
  7. HotShoe

    HotShoe Well-Known Member Licensed User

    Thanks, I'll look at it this weekend. I thought I had already fixed that, but you know what they say about getting old... :)

    --- Jem
     
  8. HotShoe

    HotShoe Well-Known Member Licensed User

    I have looked through the code and I don't find any problems, but I did add some error checking and correction to several methods. Be sure to run the startscan method only once to initialize the library. From then on run the updatewifilist method.

    I have added version 2.16 to the first post in this thread.

    --- Jem
     
  9. SimonElck

    SimonElck Member Licensed User

    Hi, I'm using MLWifi combined with jkSSH2 to create an SSH link with raspberry pi 3.
    Works great, but my phone keeps reconnecting to my home-router.
    Is there a way to bind MLwifi to one SSID? I now use a timer and:

    Code:
    sub timeout
                
    If wifi.SSID<>"MySSid" Then
                w=scan.addAP(storedid,
    "WPA2","mypassword")
                
    end sub
    But this breaks the SSH connection, not to mention the fact that I think this is very ugly.
     
  10. HotShoe

    HotShoe Well-Known Member Licensed User

    It shouldn't disconnect unless their is a signal strength problem. I don't know of any reason why wifi would have to keep reconnecting. Make sure that you are only calling the StartScan method once since it initializes the library.

    --- Jem
     
  11. SimonElck

    SimonElck Member Licensed User

    I checked and double checked. Startscan is called but once. Signal strength is not the problem, but the RPi3 does not supply good internet, so the phone, that wants to check for email and do other phone things, tries to find a better access point, even switches to 4g. Thought that I saw some java function to bind to one specific access point, but I don't speak Java.
     
  12. HotShoe

    HotShoe Well-Known Member Licensed User

    I'll look around and see what's out there.

    --- Jem
     
  13. SimonElck

    SimonElck Member Licensed User

    Thanks,I hope you will find something, much appreciated.
     
  14. Christian García S.

    Christian García S. Active Member Licensed User

    Hello, thanks for the library some months ago worked perfectly, now when I try again I receive this MAC 02:00:00:00:00:00.

    I have Android 6.0.1, I read about the changes and said you have to set new permissions: ACCESS_FINE_LOCATION or ACCESS_COARSE_LOCATION

    But I tried with new permissions and doesn't work.

    This is my manifest:

    AddPermission(android.permission.ACCESS_WIFI_STATE)
    AddPermission(android.permission.CHANGE_WIFI_STATE)
    AddPermission(android.permission.INTERNET)
    AddPermission(android.permission.ACCESS_NETWORK_STATE)
    AddPermission(android.permission.ACCESS_FINE_LOCATION)
    AddPermission(android.permission.ACCESS_COARSE_LOCATION)

    Can you help us.

    Thanks,
    Christian
     
    Last edited: May 2, 2016
  15. Erel

    Erel Administrator Staff Member Licensed User

  16. leongcc

    leongcc Member Licensed User

    Great library HotShoe.
    I encounter an issue hopefully there is help.

    While the phone is connected to WiFi, the app calls startScan once and then updateWifiList once, this triggers ScanDone once. The is correct.

    When I walked outside and losing WiFi connection, the ScanDone triggers itself repeatedly eventhough the app does not call updateWifiList. Is this normal ?
     
  17. HotShoe

    HotShoe Well-Known Member Licensed User

    Yes it is. The library monitors the background scans that Android does automatically in the background. This was a new feature in the last release.

    --- Jem
     
  18. HotShoe

    HotShoe Well-Known Member Licensed User

    A new version is attached to the first post. This version (2.17) adds the ability to get the MAC address on android M (I hope). I do not currently have a device with API 23 on it, so I hope you that do will try this version and let me know if my solution works.

    --- Jem
     
  19. NJDude

    NJDude Expert Licensed User

    It seems to work.
     
    HotShoe likes this.
  20. Dey

    Dey Active Member Licensed User

    Hello,
    Tested version 2.17 of Genymotion Android emulator 6, returns an empty string
    to return the MAC I changed
    InterfaceName String = "wlan0";
    in
    InterfaceName String = "eth1"; so it's ok
    JAVA
    You can check?
    Thank you
     
    HotShoe likes this.
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