|
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.NetworkConnectivityListener
public class NetworkConnectivityListener
A wrapper for a broadcast receiver that provides network connectivity state information, independent of network type (mobile, Wi-Fi, etc.).
| Nested Class Summary | |
|---|---|
static class |
NetworkConnectivityListener.State
|
| Constructor Summary | |
|---|---|
NetworkConnectivityListener()
Create a new NetworkConnectivityListener. |
|
| Method Summary | |
|---|---|
NetworkInfo |
getNetworkInfo()
Return the NetworkInfo associated with the most recent connectivity event. |
NetworkInfo |
getOtherNetworkInfo()
If the most recent connectivity event was a DISCONNECT, return any information supplied in the broadcast about an alternate network that might be available. |
String |
getReason()
An optional reason for the connectivity state change may have been supplied. |
NetworkConnectivityListener.State |
getState()
|
boolean |
isFailover()
Returns true if the most recent event was for an attempt to switch over to a new network following loss of connectivity on another network. |
void |
registerHandler(Handler target,
int what)
This methods registers a Handler to be called back onto with the specified what code when the network connectivity state changes. |
void |
startListening(Context context)
This method starts listening for network connectivity state changes. |
void |
stopListening()
This method stops this class from listening for network changes. |
void |
unregisterHandler(Handler target)
This methods unregisters the specified Handler. |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Constructor Detail |
|---|
public NetworkConnectivityListener()
| Method Detail |
|---|
public void startListening(Context context)
context - public void stopListening()
public void registerHandler(Handler target,
int what)
target - The target handler.what - The what code to be used when posting a message to the handler.public void unregisterHandler(Handler target)
target - public NetworkConnectivityListener.State getState()
public NetworkInfo getNetworkInfo()
NetworkInfo for the network that had the most recent connectivity event.public NetworkInfo getOtherNetworkInfo()
public boolean isFailover()
true if this was a failover attempt, false otherwise.public String getReason()
null
otherwise.
|
Build 1.0_r1(from source) | |||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||