1. Whether the network is connected (including WiFi and mobile network)
Is there a network available?
Private Boolean isnetworkconnected () {
Connectivitymanager cm =
(Connectivitymanager) Mcontext.getsystemservice (Context.connectivity_service);
Networkinfo network = Cm.getactivenetworkinfo ();
if (network! = null) {
return network.isavailable ();
}
return false;
}
2.wifi is available
//wifi is available
private Boolean iswifienable () {
& nbsp; Wifimanager Wifimanager = (wifimanager) mcontext
. Getsystemservice (Context.wifi_service);
return wifimanager.iswifienabled ();
}
3.GPS is available
Whether the GPS is available
Private Boolean isgpsenable () {
Locationmanager Locationmanager =
((Locationmanager) Mcontext.getsystemservice (Context.location_service));
Return locationmanager.isproviderenabled (Locationmanager.gps_provider);
}
Android detects if the network and GPs are available