开发者

Is there any API that i can distinguish between 3G Network and Wifi?

I am working with my ipad app. With 开发者_运维百科my iPad 3G,it's a trouble that i can't solve. I want to distinguish between 3G network and wifi in my app. Anyone had encountered the same problem before? any advice welcomed! Thanks!


You want the "reachability" API that is discussed here.


This should help:

http://www.drobnik.com/touch/2010/08/reachability/


You can use this to distinguish 3G or WIFI network~

//For 3G check
boolean is3g = manager.getNetworkInfo(ConnectivityManager.TYPE_MOBILE)
        .isConnectedOrConnecting();
//For WiFi Check
boolean isWifi = manager.getNetworkInfo(ConnectivityManager.TYPE_WIFI)
        .isConnectedOrConnecting();
0

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜