public class NetworkManagerLite
extends android.content.BroadcastReceiver
Modifier and Type | Class and Description |
---|---|
static class |
NetworkManagerLite.NetworkDevice |
Modifier and Type | Field and Description |
---|---|
static java.lang.String |
LIST_NETWORK |
static java.lang.String |
NETWORK_LIST |
static java.lang.String |
NETWORK_STATUS_CHANGED |
static java.lang.String |
TAG |
Constructor and Description |
---|
NetworkManagerLite() |
Modifier and Type | Method and Description |
---|---|
static void |
configure(NetworkManagerLite.NetworkDevice nd)
Configure an interface just given a network device.
|
static boolean |
configure(java.lang.String ifaceNameRaw)
Given the interface name configures the network.
|
static boolean |
configure(java.lang.String ifaceNameRaw,
java.lang.String addressRaw,
java.lang.String netmaskRaw,
java.lang.String gatewayRaw,
boolean createDefaultRoute,
java.lang.String dnsRaw)
Given the interfacename and the address, netmask, gateway this method switches to the root
user and configures the network.
|
static java.lang.String |
getAddress(java.net.NetworkInterface ni)
Gets the ip address of an interface that is up, return null if interface is not up or has no
address.
|
static java.util.List<NetworkManagerLite.NetworkDevice> |
getNetworkDevices()
Retrieve all of the network devices that are being tracked by network monitor.
|
void |
onReceive(android.content.Context context,
android.content.Intent intent) |
static boolean |
unconfigure(java.lang.String ifaceNameRaw) |
abortBroadcast, clearAbortBroadcast, getAbortBroadcast, getDebugUnregister, getResultCode, getResultData, getResultExtras, goAsync, isInitialStickyBroadcast, isOrderedBroadcast, peekService, setDebugUnregister, setOrderedHint, setResult, setResultCode, setResultData, setResultExtras
public static final java.lang.String TAG
public static final java.lang.String NETWORK_STATUS_CHANGED
public static final java.lang.String LIST_NETWORK
public static final java.lang.String NETWORK_LIST
public void onReceive(android.content.Context context, android.content.Intent intent)
onReceive
in class android.content.BroadcastReceiver
public static java.util.List<NetworkManagerLite.NetworkDevice> getNetworkDevices()
public static void configure(NetworkManagerLite.NetworkDevice nd)
public static java.lang.String getAddress(java.net.NetworkInterface ni)
ni
- the interface to get the ip address of.public static boolean unconfigure(java.lang.String ifaceNameRaw)
public static boolean configure(java.lang.String ifaceNameRaw, java.lang.String addressRaw, java.lang.String netmaskRaw, java.lang.String gatewayRaw, boolean createDefaultRoute, java.lang.String dnsRaw)
ifaceNameRaw
- the name of the interface to configureaddressRaw
- in IPv4 notation.netmaskRaw
- in long form.gatewayRaw
- in IPv4 notation, can be null or the empty string to denote no gateway exists.
if no gateway exists, do not set the default route.createDefaultRoute
- create a default routednsRaw
- the dns server, not set if dns is the empty string or null.public static boolean configure(java.lang.String ifaceNameRaw)
ifaceNameRaw
- the raw interface name