B4A Library Simple WIFI library

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

  1. Cableguy

    Cableguy Expert Licensed User

    I have one question, how do you test internet connection?
     
  2. HotShoe

    HotShoe Well-Known Member Licensed User

    isOnline will test if you are connected to the internet and isWifiConnected tests to see if you are connected to a router or other access point.

    --- Jem
     
  3. Filippo

    Filippo Expert Licensed User

    Thank you for this library, it is exactly what I was looking for. :)
     
  4. ivanomonti

    ivanomonti Well-Known Member Licensed User

    There is something to learn even the signal line gsm, 3g, 4g.

    thanks
     
  5. Geritt Schlag

    Geritt Schlag Member Licensed User

    Thank you for this library. Works great!
    I am search only an important point: How can i make the connection to the desired WLAN?
     
  6. HotShoe

    HotShoe Well-Known Member Licensed User

    This library is for collecting information about your wireless connection and AP's around you. It is not a wifi manager that actually makes or manages those connections.

    --- Jem
     
  7. Brad

    Brad Active Member Licensed User

    Awesome and simple library! One question. Is there a way during the scan to determine what type of security of the AP? WEP/WPA/WPA2?
     
  8. HotShoe

    HotShoe Well-Known Member Licensed User

    There is, it just isn't exposed. I'll add that in since it probably should have already been there.

    --- Jem
     
    Peter Simpson and DonManfred like this.
  9. HotShoe

    HotShoe Well-Known Member Licensed User

    Version 2.00 is in the first post. It now contains a connection manager so that you can use MLwifi to check AND connect to networks. Be sure to look over the first post carefully.
     
  10. NJDude

    NJDude Expert Licensed User

    I have written a sample showing some of the features of this simple but cool library.

    Enjoy.
     

    Attached Files:

  11. HotShoe

    HotShoe Well-Known Member Licensed User

    Looks great NJ!
     
    NJDude and thedesolatesoul like this.
  12. HotShoe

    HotShoe Well-Known Member Licensed User

    Added a new version to the first post. This is version 2.01 and adds the wificap method to get capabilities of any scanned network. I also added the new wifitest example app source that I forgot to add to the 2.00 package. Sorry for the quick update, but I want this to be complete and useable.

    In the new test app, clicking on any AP in the scanned list will allow you to see it's capabilities, and to connect to it.

    --- Jem
     
    thedesolatesoul, Brad, NJDude and 2 others like this.
  13. NJDude

    NJDude Expert Licensed User

    Can the "Link Speed" be also exposed?, I think that will complete this library.

    Awesome work Shoe.
     
    thedesolatesoul likes this.
  14. HotShoe

    HotShoe Well-Known Member Licensed User

    Absolutely.
     
    NJDude likes this.
  15. HotShoe

    HotShoe Well-Known Member Licensed User

    Version 2.10 is linked in the first post. This version adds 3 new methods and changes the way several methods must be called. I know this will break some code, but this way of calling the methods just makes much more sense than using the SSID which can be an empty string or a duplicate entry. See the included example for a demonstration of how easy and how much less code this now takes. It also increases the speed of the library very slightly.

    The new methods are :

    Disconnect - to disconnect from an AP
    isStored(EntryNumber) - to determine if this entry is already saved on the device
    LinnkSpeed - to get the speed of the current connection

    Also I have renamed 3 methods because they no longer use the SSID. Those methods are:

    addSSID is now addAP
    connectToSSID is now connectToAP
    forgetSSID is now forgetAP

    by the way, the entries returned in the wifis() array or a call to wifiList should be sorted by signal strength now.

    --- Jem
     
    Peter Simpson and NJDude like this.
  16. FrankBerra

    FrankBerra Active Member Licensed User

    Hi there i am using the following code to perform a scan:

    Code:
    Sub Button1_Click

       wiffo.startScan
       Timer1.Initialize(
    "Timer1"2000' 1000 = 1 second
       Timer1.Enabled = True

    End Sub


    Sub Timer1_Tick
       
    If wiffo.wifis <> Null Then
        Timer1.Enabled = 
    False
        
    Log (wiffo.WifiList)
        
    Log(wiffo.wifis)
       
    End If
    End Sub
    After few seconds the log says something like: "[Ljava.lang.String;@1107b928"

    Where i am wrong?
     
  17. HotShoe

    HotShoe Well-Known Member Licensed User

    That's the address of the array object returned by the call to WifiList and wifis. To get the entries use a method like in the sample project or put it into a List object.

    --- Jem
     
  18. FrankBerra

    FrankBerra Active Member Licensed User

    Perfect, it works! thank you!
    I have another question, just a curiosity...
    The OS scans the surrounding wifis in background constantly (if it is not disabled by user in the wifi settings).
    Is it possible to retrieve infos about last OS scan without performing an additional scan?
    If yes what the pro/cons?
     
  19. HotShoe

    HotShoe Well-Known Member Licensed User

    Not that I know of since I would not have access to the data. To my knowledge a new scan has to be done to get all of the features and data on each AP found.

    --- Jem
     
    thedesolatesoul likes this.
  20. FrankBerra

    FrankBerra Active Member Licensed User

    Well this code returns data of the last OS scan, even if i haven't done a scan intentionally
    Code:
    Dim R As Reflector
    R.Target = R.GetContext
    R.Target = R.RunMethod2(
    "getSystemService""wifi""java.lang.String")
    R.Target = R.RunMethod(
    "getScanResults")
    String_InfoWIFI= R.RunMethod(
    "toString")
    I get data of surrounding enviroment periodically (about every 10 min) and this code seem draining less battery than using ABWifi library. (This is why i asked you if there are PROs abaout getting wifi info without an explicit scan)
    The problem is that the code above returns empty SSID/BSSID on Samsung devices.
    MLwifi returns correct WIFI values, and in the following days i will analyze the battery consumption
     
    SimonatMSL 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