|
Build 1.0_r1(from source) | |||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectandroid.net.ConnectivityManager
public class 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:
| Field Summary | |
|---|---|
static String |
CONNECTIVITY_ACTION
A change in network connectivity has occurred. |
static int |
DEFAULT_NETWORK_PREFERENCE
|
static String |
EXTRA_EXTRA_INFO
The lookup key for a string that provides optionally supplied extra information about the network state. |
static 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. |
static String |
EXTRA_NETWORK_INFO
The lookup key for a NetworkInfo object. |
static 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. |
static String |
EXTRA_OTHER_NETWORK_INFO
The lookup key for a NetworkInfo object. |
static String |
EXTRA_REASON
The lookup key for a string that indicates why an attempt to connect to a network failed. |
static int |
TYPE_MOBILE
|
static int |
TYPE_WIFI
|
| Constructor Summary | |
|---|---|
ConnectivityManager(IConnectivityManager service)
|
|
| Method Summary | |
|---|---|
NetworkInfo |
getActiveNetworkInfo()
|
NetworkInfo[] |
getAllNetworkInfo()
|
NetworkInfo |
getNetworkInfo(int networkType)
|
int |
getNetworkPreference()
|
static boolean |
isNetworkTypeValid(int networkType)
|
boolean |
requestRouteToHost(int networkType,
int hostAddress)
Ensure that a network route exists to deliver traffic to the specified host via the specified network interface. |
void |
setNetworkPreference(int preference)
|
boolean |
setRadio(int networkType,
boolean turnOn)
|
boolean |
setRadios(boolean turnOn)
|
int |
startUsingNetworkFeature(int networkType,
String feature)
Tells the underlying networking system that the caller wants to begin using the named feature. |
int |
stopUsingNetworkFeature(int networkType,
String feature)
Tells the underlying networking system that the caller is finished using the named feature. |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Field Detail |
|---|
public static final String CONNECTIVITY_ACTION
true if there are no connected networks at all.
public static final String EXTRA_NETWORK_INFO
NetworkInfo object. Retrieve with
Intent.getParcelableExtra(String).
public static final String EXTRA_IS_FAILOVER
Intent.getBooleanExtra(String,boolean).
public static final String EXTRA_OTHER_NETWORK_INFO
NetworkInfo object. This is supplied when
there is another network that it may be possible to connect to. Retrieve with
Intent.getParcelableExtra(String).
public static final String EXTRA_NO_CONNECTIVITY
Intent.getBooleanExtra(String,boolean).
public static final String EXTRA_REASON
Intent.getStringExtra(String).
public static final String EXTRA_EXTRA_INFO
Intent.getStringExtra(String).
public static final int TYPE_MOBILE
public static final int TYPE_WIFI
public static final int DEFAULT_NETWORK_PREFERENCE
| Constructor Detail |
|---|
public ConnectivityManager(IConnectivityManager service)
| Method Detail |
|---|
public static boolean isNetworkTypeValid(int networkType)
public void setNetworkPreference(int preference)
public int getNetworkPreference()
public NetworkInfo getActiveNetworkInfo()
public NetworkInfo getNetworkInfo(int networkType)
public NetworkInfo[] getAllNetworkInfo()
public boolean setRadios(boolean turnOn)
public boolean setRadio(int networkType,
boolean turnOn)
public int startUsingNetworkFeature(int networkType,
String feature)
feature
is completely up to each networking implementation.
networkType - specifies which network the request pertains tofeature - the name of the feature to be used
-1
always indicates failure.
public int stopUsingNetworkFeature(int networkType,
String feature)
feature
is completely up to each networking implementation.
networkType - specifies which network the request pertains tofeature - the name of the feature that is no longer needed
-1
always indicates failure.
public boolean requestRouteToHost(int networkType,
int hostAddress)
networkType - the type of the network over which traffic to the specified
host is to be routedhostAddress - the IP address of the host to which the route is desired
true on success, false on failure
|
Build 1.0_r1(from source) | |||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||