android - TelephonyManager.getNetworkType() and HSDPA problems :( -


i have been using following code establish network device using :

telephonymanager tempmanager; tempmanager= (telephonymanager)mycontext.getsystemservice(context.telephony_service); int result = 0;     if(tempmanager != null && tempmanager.getnetworktype() == telephonymanager.network_type_umts) //do have umts connection ?   {    result = 2;   }   else if(tempmanager != null && tempmanager.getnetworktype() == telephonymanager.network_type_gprs) //or shabby 2g connection ?   {    result = 1;   }   else if(tempmanager != null && tempmanager.getnetworktype() == telephonymanager.network_type_unknown) //or shabby 2g connection ?   {    result = 4;   } return result; 

it works pretty unless on hsdpa connection, in case return 0 result, in case makes software think has no connection @ :(

anyone knows whats happening, has experience regarding , importantly has solution problem ???

thanks in advance

there enum hsdpa

to check if there connection , type, rather user getactivenetworkinfo , isconnected. returns null when there no connection. can check type of connection gettype , getsubtypename methods or can mix approach.


Comments

Popular posts from this blog

asp.net - repeatedly call AddImageUrl(url) to assemble pdf document -

java - Android recognize cell phone with keyboard or not? -

iphone - How would you achieve a LED Scrolling effect? -