开发者

Android 3G Connection

开发者 https://www.devze.com 2023-03-25 18:22 出处:网络
When i am using wifi network all is working fine ,,but when i turn off all network(Not Airplance mode) and turn on 3G HotSpot th开发者_如何转开发en my application is not even detecting connection.So w

When i am using wifi network all is working fine ,,but when i turn off all network(Not Airplance mode) and turn on 3G HotSpot th开发者_如何转开发en my application is not even detecting connection.So web service shwoing timeout errors.

ConnectivityManager cm = (ConnectivityManager)getSystemService
(Context.CONNECTIVITY_SERVICE);;
boolean 3GCon=cm.getNetworkInfo(ConnectivityManager.TYPE_MOBILE).isConnected()

This returning always false


Why not try using isAvailable() instead of isConnected()?


It's very difficult to give you an exact answer as to why it's not working for you, but as a start I suggest you look through an example such as this ConnectivityManagerTestActivity and compare it with your own code.

0

精彩评论

暂无评论...
验证码 换一张
取 消