B4A Library Simple WIFI library Updated V. 3.03 04-04-2017

Discussion in 'Additional libraries, classes and official updates' started by bgsoft, Feb 15, 2017.

  1. bgsoft

    bgsoft Well-Known Member Licensed User

    Hi:

    I have implemented new methods and events:

    Changes v-3.03:
     
  2. bgsoft

    bgsoft Well-Known Member Licensed User

    With the new library 3.03, you can use the NoEventOnSystemScan parameter of the method StartScan.
    Or the Stopscan method.

    Regards
     
    FrankBerra likes this.
  3. JTmartins

    JTmartins Active Member Licensed User

    I have some problems with this...

    In one device I always get a false status. Even when connection is achieved.

    In other device it reports properly for WPA, but it always reports true for WEP (even trying to connect with wrong password) even when connection is not achieved.
     
    Last edited: Apr 4, 2017
  4. hayderOICO

    hayderOICO Member Licensed User

    hi

    is it possible to add an ap with "advanced settings" ? i.e. static IP configuration?
     
  5. DonManfred

    DonManfred Expert Licensed User

    Look at the documentation....

    addAP (EntryNumber As Int, securityType As String, Password As String) As Boolean
    Adds an entry to the wifi manager and connects to it. This method saves the configuration of the new entry onto the device. Use the forgetAP method to delete them. Updated to handle quoted or unquoted SSID strings.
    EntryNumber - If you display the string array wifis or the array returned in the getWifiList method UNSORTED, you can pass the Position variable from your ListView_Click event.
    Otherwise, you must pass the entry number from the string array since that is what is used as a reference.
    securityType - The Access Point security type (returned in the scan result string array)
    Password - The password/phrase for the wifi access point. Pass "" for an open network. Handles WEP HEX or text phrases
    It is up to you to supply all information. The security type is found in the scan results array.

    So i would guess yes.
     
    bgsoft likes this.
  6. Humberto

    Humberto Active Member Licensed User

  7. sfgwl

    sfgwl Member Licensed User

     
  8. b4xscripter

    b4xscripter Member Licensed User

    Can you please upload an example?
    Thank you!
     
  9. bgsoft

    bgsoft Well-Known Member Licensed User

    Hi, I have answered you in the Spanish forum.

    Regards
     
  10. mterveen

    mterveen Member Licensed User

    Potential Bug - If you have a service called "Wifi" in your program it will cause compilation errors with this library.
     
    spairo likes this.
  11. Matt and John

    Matt and John New Member Licensed User

    On some older devices of mine ScanDone returns Results() properly in a service when no activities are showing, but on android 7.0 (or maybe just this device), ScanDone fires, however there are always empty Results() in the service when the activity is paused?

    How can I still get Results() in a service when my activity isn't showing? Is it a bug in this library?

    *edit - I found it happens only when the home button is pressed, but not when the power button turns off the screen.

    Both raise the same activity pause - user closed = false event for activity, im confused
     
    Last edited: Mar 14, 2018
  12. FrankBerra

    FrankBerra Active Member Licensed User

    Maybe it is something related to this:
    Android 6+ requires location for scanning wifi.
    Info: https://stackoverflow.com/questions...-m-requires-location-permissions-to-scan-wifi

    More detailed infos here:
    https://developer.android.com/reference/android/net/wifi/WifiManager.html#getScanResults()
    " An app must hold ACCESS_COARSE_LOCATION or ACCESS_FINE_LOCATION permission in order to get valid results."

    Adding the following lines in your manifest should solve the problem:
    AddPermission(android.permission.ACCESS_FINE_LOCATION)
    AddPermission(android.permission.ACCESS_COARSE_LOCATION)
     
  13. tmf

    tmf Member Licensed User

    Can this library handle hidden SSIDs?
     
  14. Michael Wenning

    Michael Wenning Member Licensed User

    I have tried the scan function on Android 7 Samsung A3.
    See attached project file.
    I add permissions
    AddPermission(android.permission.ACCESS_FINE_LOCATION)
    AddPermission(android.permission.ACCESS_COARSE_LOCATION)
    in manifest.
    I have got always empty results on ScanDone firing.
    On some older devices (< Android 6.0) of mine ScanDone returns Results() properly. ( See post #31).
    I am thankful for every tip!
     

    Attached Files:

  15. Michael Wenning

    Michael Wenning Member Licensed User

  16. Matt and John

    Matt and John New Member Licensed User

    Still has same issue as in post #31

    An example that reproduces the error is attached.

    On android 7, when you press 'home', the scan results in log output become 0, however, when you press the power button (to turn screen off), normal scan results are returned.

    Both actions trigger the same ** Activity (main) Pause, UserClosed = false ** event

    So why does pressing home return 0 wifi results (from a running service)? Is it a library bug? (It works fine on android 6 and below, just not on 7)

    *edit - setting target APK to 26 get no scan results at all
     

    Attached Files:

    Last edited: Apr 17, 2018
  17. Michael Wenning

    Michael Wenning Member Licensed User

    Hello again,
    i have updated the Android 7 Samsung A3 mobile phone to Android 8.0
    The same code/app as in android 7.0.
    No scan results at all. I reinstalled the app and added runtimepermission for the dangerous permissions.
    Still no scanresult.
    I am happy about any help.
     
  18. Matt and John

    Matt and John New Member Licensed User

    Be sure you have downloaded the SDK you are targeting.

    (Click Tools / SDK Manager, search SDK Platform 26 or your manifest's targetSdkVersion="26", select in the list and click Install Selected)
     
    Last edited: Jun 16, 2018
  19. DonManfred

    DonManfred Expert Licensed User

    Please create a new thread in the Questions forum for your question.
    You are not handling the runtimepermissions correctly.
    You are not targeting sdk 26

    Running on Samsung Note 8, Android 8, TargetSDK 26

     

    Attached Files:

  20. Michael Wenning

    Michael Wenning Member Licensed User

    Thank you Manfred!
    I have checked your "Demo new" but no succsess:

    ** Activity (main) Create, isFirst = true **
    ** Activity (main) Resume **
    ** Activity (main) Pause, UserClosed = false **
    sending message to waiting queue (activity_permissionresult)
    running waiting messages (1)
    ** Activity (main) Resume **
    *** Service (icon) Create ***
    ** Service (icon) Start **
    Wifi scan started!
    scan done 0
    scan done 0
    scan done 0

    Verzeichniskonfiguration:

    C:\Program Files\Java\jdk-10.0.1\bin\javac.exe

    C:\Program Files (x86)\Android\android-sdk\platforms\android-26\android.jar

    B4A Vers 8.3

    I have tried 3 times with App deinstallation and "Projekt säubern"

    I am always asked once for the release and agree.
    The runtime permission seem to be okay.
    Still no success....

    Any idea?

    Thanks and regards from Wuppertal
    Michael
     
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