B4A Library Simple WIFI library

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
 

HotShoe

Well-Known Member
Licensed User
There is a Disconnect method, is it not working for you?

--- Jem
 

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:

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
 

HotShoe

Well-Known Member
Licensed User
Hi all,

Has anyone an idea?
Lutz
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
 

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:

B4X:
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.
 

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
 

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.
 

HotShoe

Well-Known Member
Licensed User
I'll look around and see what's out there.

--- Jem
 

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:

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 ?
 

HotShoe

Well-Known 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 ?
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
 

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
 

NJDude

Expert
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
It seems to work.
 

Dey

Active 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
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
 
Top