i i am checking network type by calling this function
ConnectivityManager cm = (ConnectivityManager) getSystemService(Context.CONNECTIVITY_SERVICE);
NetworkInfo Info = cm.getActiveNetworkInfo();
if (Info == null || !Info.isConnectedOrConnecting()) {
Log.i(TAG, "No connection");
} else {
int netType = Info.getType();
int netSubtype = Info.getSubtype();
if (netType == ConnectivityManager.TYPE_WIFI) {
Log.i(TAG, "Wifi connection");
//Need to get wifi strength
} else if (netType == ConnectivityManager.TYPE_MOBILE) {
Log.i(TAG, "GPRS/3G connection");
//Need to get differentiate between 3G/GPRS
}
}
i do not want to poll wifi strength regularly,but when i do some network stuff i need to check connected wifi strength which i am unable to get.
Secondly when i get netType() as MOBILE how can i determine its 3G/GPRS form netSubType, i mean what are the integer values for 3g/Gprs etc.
Please anyone have idea how to do this.
Thanks
1 Answer