Android Question Hotspot and MLwifi problem

davemorris

Active Member
Licensed User
Longtime User
Hi, Guys

I am having a problem with the MLwifi library.

I have a App which communicate with other devices on network (all running the same application).

I have in the past successfully used the .isWifiConnected to check if a device is connected to the Wifi. However, if that device is also set as a Wifi Hotspot then isWifiConnected returns false. There appears nothing wrong with my code, as removing these checks the run correctly. Also other devices (not setup as the Hotspot) will also work OK (with the original code). It is important for the App to check for Wifi as it appears that many uses like to switch off there Wifi connection to save battery power.

Any suggestions?
Dave Morris
 

Peter Simpson

Expert
Licensed User
Longtime User
Can you post an example of the code that you are using @davemorris (your code), I'm going to presume that you have already added RTP if you are using SDK26+
 
Upvote 0

davemorris

Active Member
Licensed User
Longtime User
Can you post an example of the code that you are using @davemorris (your code), I'm going to presume that you have already added RTP if you are using SDK26+

Hi, Peter - Thanks for the quick response.

I am using SDK=26, so could have RTP problems - however the IDE "List Remissions" does not shown any problems, so is that ok?
Code sample attached (public sub to check if Wifi enabled and runs in a Service module). If I always return true the code runs on a device set as a hotspot otherwise the calling code detects no Wifi and will not allow the App to run.

B4X:
public Sub pIsWifiOn As Boolean
    Dim wifiLocal As MLwifi
    Return wifiLocal.isWifiEnabled
End Sub

Any suggestions?
Dave
 
Upvote 0
Top