java.lang.Object | ||
android.net.ConnectivityManager |
Class that answers queries about the state of network connectivity. It also notifies applications when network connectivity changes. Get an instance of this class by calling Context.getSystemService(Context.CONNECTIVITY_SERVICE).
The primary responsibilities of this class are to:
Value | ||||
---|---|---|---|---|
String | CONNECTIVITY_ACTION | A change in network connectivity has occurred. | "android.net.conn.CONNECTIVITY_CHANGE" | |
ConnectivityManager.NetworkPreference | DEFAULT_NETWORK_PREFERENCE | |||
String | EXTRA_EXTRA_INFO | The lookup key for a string that provides optionally supplied extra information about the network state. | "extraInfo" | |
String | EXTRA_IS_FAILOVER | The lookup key for a boolean that indicates whether a connect event is for a network to which the connectivity manager was failing over following a disconnect on another network. | "isFailover" | |
String | EXTRA_NETWORK_INFO | The lookup key for a NetworkInfo object. | "networkInfo" | |
String | EXTRA_NO_CONNECTIVITY | The lookup key for a boolean that indicates whether there is a complete lack of connectivity, i.e., no network is available. | "noConnectivity" | |
String | EXTRA_OTHER_NETWORK_INFO | The lookup key for a NetworkInfo object. | "otherNetwork" | |
String | EXTRA_REASON | The lookup key for a string that indicates why an attempt to connect to a network failed. | "reason" |
NetworkInfo | getActiveNetworkInfo() | |||||
NetworkInfo[] | getAllNetworkInfo() | |||||
NetworkInfo | getNetworkInfo(NetworkType networkType) | |||||
ConnectivityManager.NetworkPreference | getNetworkPreference() | |||||
void | setNetworkPreference(ConnectivityManager.NetworkPreference preference) | |||||
boolean | setRadio(NetworkType networkType, boolean turnOn) | |||||
boolean | setRadios(boolean turnOn) | |||||
int | startUsingNetworkFeature(NetworkType networkType, String feature) | |||||
Tells the underlying networking system that the caller wants to begin using the named feature. | ||||||
int | stopUsingNetworkFeature(NetworkType networkType, String feature) | |||||
Tells the underlying networking system that the caller is finished using the named feature. |
true
if there are no connected networks at all.
feature
is completely up to each networking implementation.
networkType | specifies which network the request pertains to |
---|---|
feature | the name of the feature to be used |
-1
always indicates failure.
feature
is completely up to each networking implementation.
networkType | specifies which network the request pertains to |
---|---|
feature | the name of the feature that is no longer needed |
-1
always indicates failure.
Copyright 2007 Google Inc. | Build 0.9_r1-98467 - 14 Aug 2008 18:48 |