B4A Library MLwifi Library Updated to v4.00

Acuario

Member
Licensed User
Longtime User
I'm using the MLWifi400 library to switch WiFi connections and have now got that working correctly.
Is it possible to switch the connections silently, i.e. without the confirmation dialog (with its timeout)?
If the WiFi network I want to connect to is available then I want to connect to it - I don't want to have to confirm the connection.
This is part of an automatic configuration process for an ESP8266 and I want as little user interaction as possible.
 

Computersmith64

Well-Known Member
Licensed User
Longtime User

It depends on the version of Android running on the device trying to connect. I'd suggest you have a read of this thread from the start (post #16 might be relevant to your question) & then see if you still have questions. The short answer is that if you're trying to connect from a device running Q+, you can't do it silently.

- Colin.
 

Acuario

Member
Licensed User
Longtime User
Ok, so it looks like not then.. a pity - I don't know how they achieve it in the ESP touch library but there is no confirmation needed there - I need to dig into their code a bit more to see if they are connecting to an AP.

Anyway, that aside, I have a problem that I can't seem to crack (well I can but not how it seems it should work).

My 'fresh' ESP knows nothing so it boots into AP mode.
Using MLWifi I connect to my ESP, no problem (after confirming in the dialog box).
I send the WiFi credentials to it, it then saves them and reboots to connect to the WiFi.
My phone then disconnects from the AP (as the AP no longer exists) and being a Q+ reconnects to the original WiFi.
If I just leave the phone to reconnect to its original WiFi in this way (which it does) my app can no longer connect to anything using HTTP.
Oddly, UDP works and I can send packets (I use UDP broadcast to get the IP address of the newly configured ESP) but with HTTP I get a socket exception.

To solve this (but not the way I would like) I have to re-scan the WiFi and then explicitly connect to the WiFi (using WiFi.ConnectWiFiAP with the ssid and password).
When it is reconnected then it will once again connect via HTTP.

Also closing my app and re-starting it also 're-enables' connections via HTTP.

As I say, it works but not as I would expect, having to force the reconnect to the original WiFi.
Any ideas?
 

Jmu5667

Well-Known Member
Licensed User
Longtime User
Hi Colin

There is an app called Wifi Analyzer - Apps on Google Play and when it does a scan it can show the chanel, mac, signal, chn Herts (2.4/5), can MLwifi do the same please.. It would be really useful if it could as we have a use case for being able to do that. I am currently using MLWifi 4.40.

Regards

John.
 

danoveb

Member
Licensed User
Longtime User
How do I set the debug property? I have a specific phone that behave weird with this library. (Works great on any other phone).
I never get the _Scandone event, and also if I use the MLwifi, WifiSSID returns "<unknown ssid>" no mather what SSID I am connected to. I think I messed up something in the phone when fiddling with the PreferWifiRouting
 

danoveb

Member
Licensed User
Longtime User
Nevermind, found the issue. Had lost the PERMISSION_ACCESS_FINE_LOCATION permission...
 

Lakhtin_V

Active Member
Licensed User
Longtime User
Hi, Who can offer an example that works correctly with this version of the library. I am a beginner and it is not clear to me how to run such an example, I would like to test smartphones in Wi-Fi direct without using a router. So you need to debug the USB cable, and turn off the Wi-Fi router. What are the requirements for the androyd version and the lines in the manifest?
 

Computersmith64

Well-Known Member
Licensed User
Longtime User
Yes, it would be great if you could post it.

Thanks

John
I'm travelling at the moment but will be home tomorrow, so I'll do it over the next couple of days.

- Colin.
 

Computersmith64

Well-Known Member
Licensed User
Longtime User
Thanks Colin
I've attached the source (MLWifi.zip) to the first post in this thread. It's only the Java file as the entire Android Studio project zipped was too big (900 KB) for the forum. If you want the entire project, send me a private message with your email address & I'll send it to you.

- Colin.
 
Cookies are required to use this site. You must accept them to continue using the site. Learn more…