If you use a browser by disabling 3G (by pressing F8), the browser will still work without any problems. I need a similar type of functionality in my application, how can I implement it in my application.
We are currently using the following code in our application:
protected boolean isNetworkCoverageAvailable()
{
boolean result = false;
Context oContext = AndroidContext.getContext();
ConnectivityManager connMgr = (ConnectivityManager) oContext.getSystemService(Context.CONNECTIVITY_SERVICE);
NetworkInfo wifi = connMgr.getNetworkInfo(ConnectivityManager.TYPE_WIFI);
NetworkInfo mobile = connMgr.getNetworkInfo(ConnectivityManager.TYPE_MOBILE);
if(wifi.isConnected() == true){
result = true;
} else if (mobile.isConnectedOrConnecting() == true){
result = true;
} else {
result = oMgr.getDataState() == TelephonyManager.DATA_CONNECTED;
}
Log.d(TAG, "Result: " + result + "");
return result;
}
The application works for Wi-Fi and 3G, but I want the application to automatically activate 3G if 3G is paused due to the unusual device.
How can I do this in Android?
source
share