0

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

David
  • 303
  • 1
  • 2
  • 9

1 Answers1

0

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 ;
}