GetNetworkType Issue

joedarock

Member
Licensed User
Longtime User
My app queries GetNetworkType from the Phone library. However, if I switch to the 3G network from the WiFi network while the app is running, GetNetworkType still indicates "WiFi". Is this a bug, or do I have to do something else before I can read GetNetworkType?

Joe

After looking at my code again, I see that there is no "WiFi" result string; I translated the result string from "EVDO_A" to "WiFi" in code. Regardless, it doesn't seem to change when I switch networks.
 
Last edited:

joedarock

Member
Licensed User
Longtime User
Thanks Erel,

What I'm looking for is something that will tell me what network is in use at the time of app activation (WiFi or mobile), and also will tell me if the network in use changes while the app is running. Does any one method tell me both, or do I need to invoke a couple of methods?

Joe
 

kkolle

Member
Licensed User
Longtime User
Hi Erel!

I just want to know, if this is the right behavior.
In the log you can see that I´m checking the "NetworkType" and the "DataState" every two seconds.

When I turn the WiFi on, the "ConnectivityChanged"-event informs about the new type and state.

After that there is no informaion about the WiFi, when I check the "NetworkType" and the "DataState" again.

Is that the right behavior?

Thanks for your help!

B4X:
091923 - GetNetworkType: EDGE
091923 - GetDataState: CONNECTED

091924 - ConnectivityChanged: NetworkType - WIFI, State - CONNECTED
091924 - ExtrasToString: Bundle[{networkInfo=NetworkInfo: type: WIFI[], state: CONNECTED/CONNECTED, reason: (unspecified), extra: (none), roaming: false, failover: false, isAvailable: true}]

091925 - GetNetworkType: EDGE
091925 - GetDataState: CONNECTED

091926 - ConnectivityChanged: NetworkType - mobile, State - DISCONNECTED
091926 - ExtrasToString: Bundle[{extraInfo=internet, otherNetwork=NetworkInfo: type: WIFI[], state: CONNECTED/CONNECTED, reason: (unspecified), extra: (none), roaming: false, failover: true, isAvailable: true, reason=dataDisabled, networkInfo=NetworkInfo: type: mobile[EDGE], state: DISCONNECTED/DISCONNECTED, reason: dataDisabled, extra: internet, roaming: false, failover: false, isAvailable: true}]

091926 - ConnectivityChanged: NetworkType - WIFI, State - CONNECTED
091926 - ExtrasToString: Bundle[{isFailover=true, networkInfo=NetworkInfo: type: WIFI[], state: CONNECTED/CONNECTED, reason: (unspecified), extra: (none), roaming: false, failover: false, isAvailable: true}]

091927 - GetNetworkType: EDGE
091927 - GetDataState: DISCONNECTED
 

kkolle

Member
Licensed User
Longtime User
OK. I understand!

Is it possible to get the state of the WiFi?
Is it possible with the ABWifi-library?
 
Top