5

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!

snail
  • 226
  • 3
  • 18

3 Answers3

3

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

Community
  • 1
  • 1
Joshua Nozzi
  • 60,946
  • 14
  • 140
  • 135
  • Did you follow both links I gave you? The second link (to another question here on StackOverflow) even gives a complete code listing that shows the answer is yes. – Joshua Nozzi Nov 08 '10 at 18:08
  • Thanks for your answer, I just want to confirm this questions again. Because I am at home now and don't have 3G card to verify. – snail Nov 08 '10 at 18:23
1

This should help:

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

Evan Mulawski
  • 54,662
  • 15
  • 117
  • 144
-4

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();