PC SOFT

GRUPOS DE DISCUSSÃO PROFISSIONAL
WINDEVWEBDEV e WINDEV Mobile

Inicio → WINDEV Mobile 2024 → [WM24] Detect Wifi or cellular network on Android and iOS
[WM24] Detect Wifi or cellular network on Android and iOS
Iniciado por rob, dez., 16 2019 4:43 PM - 1 resposta
Membro registado
105 mensagems
Publicado em dezembro, 16 2019 - 4:43 PM
Is there a way to determine if a phone is connected to a WiFi network, or to the cellular network? WifiStatus() returns wifiEnabled anytime the wireless adapter is turned on, even if it's not connected.

My reasoning being that I want to provide the user a prompt if they're connected to a cellular network, and not Wifi because the app will download some data and use their mobile data plan.

Thank you!
Publicado em dezembro, 21 2019 - 6:21 PM
This might help ..

sNetworkType is string = "" //used to check mobile network connection
sNetworkName is string = "" //used to check network name
sWifi is string = "" //used to id the wifi network


PROCEDURE CheckMobileAndWifi()
sNetworkType = MobileNetworkConnectionInfo(networkType )
sNetworkName = MobileNetworkConnectionInfo(networkOperator)
sWifi = WiFiConnectionInfo(wifiSSID)
sSimCardResult is string = ""
sWifiResult is string = ""
bInternetConnected is boolean = InternetConnected()

IF NoSpace(sNetworkType) = "0" AND NoSpace(sNetworkName) = "" THEN
sSimCardResult = "No Sim Card detected."
ELSE
sSimCardResult = (sNetworkName)
END

IF NoSpace(sWifi) <> "" THEN
sWifiResult = "You are connected to " + sWifi +"."
ELSE
sWifiResult = "No Wifi available."
END

RESULT sSimCardResult + "," + sWifiResult + "," + bInternetConnected