user3586231
user3586231

Reputation: 365

In android is there any event trigger, when network type change

In Android there is a availability of different types of network that is 3g,EDGE,LTE etc. i am searching for the event when user network type change from EDGE to 3g,LTE and vice versa.

Upvotes: 0

Views: 582

Answers (1)

Illegal Argument
Illegal Argument

Reputation: 10338

There is a broadcast receiver that will get called whenever network state changes(connection lost,changed,etc). In the receiver class you would have to figure out the kind of network network you are intrested in. The connectivity manager class will help you figure out the type of connected network.

boolean isWiFi = activeNetwork.getType() == ConnectivityManager.TYPE_WIFI;

Update:

You can use TelephonyManager.getNetworkType() but I am not aware of any broadcast receiver that can be registered to be notified about the change in the network.

Upvotes: 3

Related Questions