I create an application and I need to do so when the user has 3G enabled so that he has a dialog "You have 3G enabled, connect to WiFI How can I limit the use of 3G?
Help please
I create an application and I need to do so when the user has 3G enabled so that he has a dialog "You have 3G enabled, connect to WiFI How can I limit the use of 3G?
Help please
You can use ConnectivityManager to check information about current connected networks :
private boolean haveMobileConnection() {
ConnectivityManager cm = (ConnectivityManager)
getSystemService(Context.CONNECTIVITY_SERVICE);
NetworkInfo[] netInfo = cm.getAllNetworkInfo();
for (NetworkInfo ni : netInfo) {
if (ni.getTypeName().equalsIgnoreCase("MOBILE"))
if (ni.isConnected())
return true;
}
return false ;
}