|
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.os.Handler
android.net.NetworkStateTracker
public abstract class NetworkStateTracker
Each subclass of this class keeps track of the state of connectivity of a network interface. All state information for a network should be kept in a Tracker class. This superclass manages the network-type-independent aspects of network state.
| Field Summary | |
|---|---|
static int |
EVENT_CONFIGURATION_CHANGED
|
static int |
EVENT_NOTIFICATION_CHANGED
arg1: 1 to show, 0 to hide arg2: ID of the notification obj: Notification (if showing) |
static int |
EVENT_SCAN_RESULTS_AVAILABLE
|
static int |
EVENT_STATE_CHANGED
|
protected Context |
mContext
|
protected NetworkInfo |
mNetworkInfo
|
protected Handler |
mTarget
|
| Constructor Summary | |
|---|---|
NetworkStateTracker(Context context,
Handler target,
int networkType)
|
|
| Method Summary | |
|---|---|
protected static String[] |
getNameServerList(String[] propertyNames)
Return the IP addresses of the DNS servers available for this network interface. |
abstract String[] |
getNameServers()
Return the list of DNS servers associated with this network. |
NetworkInfo |
getNetworkInfo()
|
abstract String |
getTcpBufferSizesPropName()
Return the system properties name associated with the tcp buffer sizes for this network. |
void |
interpretScanResultsAvailable()
Interprets scan results. |
abstract boolean |
isAvailable()
Returns an indication of whether this network is available for connections. |
abstract boolean |
reconnect()
Reenable connectivity to a network after a teardown(). |
void |
releaseWakeLock()
Release the wakelock, if any, that may be held while handling a disconnect operation. |
boolean |
requestRouteToHost(int hostAddress)
Ensure that a network route exists to deliver traffic to the specified host via this network interface. |
protected void |
sendScanResultsAvailable()
Send a notification that the results of a scan for network access points has completed, and results are available. |
void |
setDetailedState(NetworkInfo.DetailedState state)
Record the detailed state of a network, and if it is a change from the previous state, send a notification to any listeners. |
void |
setDetailedState(NetworkInfo.DetailedState state,
String reason,
String extraInfo)
Record the detailed state of a network, and if it is a change from the previous state, send a notification to any listeners. |
protected void |
setDetailedStateInternal(NetworkInfo.DetailedState state)
|
abstract boolean |
setRadio(boolean turnOn)
Turn the wireless radio off for a network. |
abstract void |
startMonitoring()
|
abstract int |
startUsingNetworkFeature(String feature,
int callingPid,
int callingUid)
Tells the underlying networking system that the caller wants to begin using the named feature. |
abstract int |
stopUsingNetworkFeature(String feature,
int callingPid,
int callingUid)
Tells the underlying networking system that the caller is finished using the named feature. |
abstract boolean |
teardown()
Disable connectivity to a network |
void |
updateNetworkSettings()
Reads the network specific TCP buffer sizes from SystemProperties net.tcp.buffersize.[default|wifi|umts|edge|gprs] and set them for system wide use |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
| Field Detail |
|---|
protected NetworkInfo mNetworkInfo
protected Context mContext
protected Handler mTarget
public static final int EVENT_STATE_CHANGED
public static final int EVENT_SCAN_RESULTS_AVAILABLE
public static final int EVENT_NOTIFICATION_CHANGED
public static final int EVENT_CONFIGURATION_CHANGED
| Constructor Detail |
|---|
public NetworkStateTracker(Context context,
Handler target,
int networkType)
| Method Detail |
|---|
public NetworkInfo getNetworkInfo()
public abstract String[] getNameServers()
public abstract String getTcpBufferSizesPropName()
protected static String[] getNameServerList(String[] propertyNames)
propertyNames - the names of the system properties whose values
give the IP addresses. Properties with no values are skipped.
Strings containing the IP addresses
of the DNS servers, in dot-notation. This may have fewer
non-null entries than the list of names passed in, since
some of the passed-in names may have empty values.public void updateNetworkSettings()
public void releaseWakeLock()
public void setDetailedState(NetworkInfo.DetailedState state)
state - the new @{code DetailedState}
public void setDetailedState(NetworkInfo.DetailedState state,
String reason,
String extraInfo)
state - the new @{code DetailedState}reason - a String indicating a reason for the state change,
if one was supplied. May be null.extraInfo - optional String providing extra information about the state changeprotected void setDetailedStateInternal(NetworkInfo.DetailedState state)
protected void sendScanResultsAvailable()
public abstract void startMonitoring()
public abstract boolean teardown()
true if a teardown occurred, false if the
teardown did not occur.public abstract boolean reconnect()
teardown().
public abstract boolean setRadio(boolean turnOn)
turnOn - true to turn the radio on, falsepublic abstract boolean isAvailable()
false means that some quasi-permanent
condition prevents connectivity to this network.
public abstract int startUsingNetworkFeature(String feature,
int callingPid,
int callingUid)
feature
is completely up to each networking implementation.
feature - the name of the feature to be usedcallingPid - the process ID of the process that is issuing this requestcallingUid - the user ID of the process that is issuing this request
-1
always indicates failure.
public abstract int stopUsingNetworkFeature(String feature,
int callingPid,
int callingUid)
feature
is completely up to each networking implementation.
feature - the name of the feature that is no longer needed.callingPid - the process ID of the process that is issuing this requestcallingUid - the user ID of the process that is issuing this request
-1
always indicates failure.public boolean requestRouteToHost(int hostAddress)
hostAddress - the IP address of the host to which the route is desired
true on success, false on failurepublic void interpretScanResultsAvailable()
|
Build 1.0_r1(from source) | |||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||