im making an app using SDK 7 (aos 2.1). But my app refuses to work properly on HTC EVO which is 2.2 due to using 4G connection. My app can't figure out that there is an Internet connection available cause it neither TYPE_MOBILE nor TYPE_WIFI. What to do in such a situation? Should i make 2 versions of app one for 2.1 and another for 2.2?
there is a possibility to manage 4G in API 2.1 (level 7). I did it in following way
final ConnectivityManager cm = (ConnectivityManager)context.getSystemService(Context.CONNECTIVITY_SERVICE);
if (cm==null)
return false;
final NetworkInfo activeNetwork = cm.getActiveNetworkInfo();
if (activeNetwork==null)
return false;
// determine the type of network
switch (activeNetwork.getType()){
case 6:
isInternetWiMax = true;
break;
case ConnectivityManager.TYPE_WIFI:
isInternetWiFi = true;
break;
case ConnectivityManager.TYPE_MOBILE:
isInternetMobile = true;
break;
}
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.