Android Question MLWiFi and Android 9

Status
Not open for further replies.

Nitin Joshi

Active Member
Licensed User
Hi, MLWiFi library is not working properly while APP is working on Android 9. For example, it does not give WiFiSSID, isWiFiConnected and many more functions. APP was running fine before my phone was upgraded.
I have verified it as I ran the APP on other mobile which has Android 7.0.
Can anyone help?
 

Erel

Administrator
Staff member
Licensed User
Mistakes in code:
1. Never use Http library. Only OkHttpUtils2.
2. Loading a layout when FirstTime = True is most probably a mistake.
3. You need to handle the location permission to get the wifi information.

Make sure to use the latest version of MLWifi. Working code:
B4X:
Sub Process_Globals
   Private WiFi As MLwifi
   Private rp As RuntimePermissions       
End Sub

Sub Globals
   
End Sub

Sub Activity_Create(FirstTime As Boolean)
   rp.CheckAndRequest(rp.PERMISSION_ACCESS_FINE_LOCATION)
   Wait For Activity_PermissionResult (Permission As String, Result As Boolean)
   If Result Then
       Log(WiFi.isOnLine)
       Log(WiFi.isWifiConnected)
       Log(WiFi.SSID)
   Else
       Log("no permission")
   End If
End Sub
 

Nitin Joshi

Active Member
Licensed User
Erel, thanks. Please help on my below queries...

Mistakes in code:
1. Never use Http library. Only OkHttpUtils2....................How to change the library. Please let me know more about it.
2. Loading a layout when FirstTime = True is most probably a mistake......................Ok. Noted.
3. You need to handle the location permission to get the wifi information................Is it applicable to Android 9 version?

Make sure to use the latest version of MLWifi. Working code:............What is the latest version? Can you share with me?

Last one....Why app working fine in Android 8 and lower version with same code?
 

DonManfred

Expert
Licensed User

Nitin Joshi

Active Member
Licensed User
Have you tried to FIND the info by yourself by searching for okhttputils2 library or any tutorial? I mean before asking... I´m pretty sure you did not....

Yes, I got the answer....
 

Nitin Joshi

Active Member
Licensed User
I am able to get the WiFi SSID correct however isWiFiConnected returns true only if device is reachable to internet else it returns false.

Let me tell you little bit more...
My home WiFi SSID is "Mumbai Indians", this network is connected to internet.
There is one more SSID, generated using ESP8266 as AP whose name is "Smart_Home".

My observation as below.
Mobile WiFi connected to SSID: Mumbai Indians, APP result as below
isWiFiConnected: true
WiFiSSID: Mumbai Indians

Mobile WiFi connected to SSID: Smart_Home, APP result as below
isWiFiConnected: false
WiFiSSID: Smart_Home

Please let me know the reason for this.
 
Status
Not open for further replies.
Top