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?
 

Nitin Joshi

Active Member
Licensed User
Hi Erel, Please find attached project. Along with this, I am attaching a word file wherein I have attached screen shot of output taken on 2 handsets, Android 9 & Android 7.
 

Attachments

  • Sample Project.zip
    9.7 KB · Views: 303
  • Android 7 output.JPG
    Android 7 output.JPG
    25.3 KB · Views: 293
  • Android 9 output.JPG
    Android 9 output.JPG
    20.8 KB · Views: 326
Upvote 0

Erel

B4X founder
Staff member
Licensed User
Longtime 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
 
Upvote 0

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?
 
Upvote 0

DonManfred

Expert
Licensed User
Longtime User
Upvote 0

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....
 
Upvote 0

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.
 
Upvote 0
Status
Not open for further replies.
Top