Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

iPhones OS: how to programmatically differentiate iPad 3G from iPad Wi-Fi?

Tags:

iphone

ipad

Is there any property or other mechanism in iPhone OS to check during runtime whether application is running on iPad 3G or iPad Wi-Fi? Seems like UIDevice class does not provide anything like that.

My application is using internet access extensively and I would like to explicitly warn user that on 3G delays or additional costs can be expected OR even ban application from running on iPad 3G with some fancy popup.

like image 395
matm Avatar asked May 18 '10 13:05

matm


People also ask

How do I know if my iPad is 3G or 4g?

On the back of the iPad there should be a black piece (side where the headphone is). Look on the top right corner of the iPad screen. Does it say LTE or 3G?

How do I connect my iPad to my iPhone Wi-Fi?

Wi-Fi. On the device that you want to connect to, go to Settings > Cellular > Personal Hotspot or Settings > Personal Hotspot and make sure that it's on. Then verify the Wi-Fi password and name of the phone. Stay on this screen until you've connected your other device to the Wi-Fi network.

Can I use my phone data allowance on my iPad?

As long as you have your iPhone, you can share its data connection with your iPad through a process called tethering.


2 Answers

I assume that other than 3G networking capabilities, there is no need to make a difference. Using Reachability.h class provided by Apple you can check if internet connection is available and if it is Mobile network or Wireless network.

Sample code here: http://developer.apple.com/iphone/library/samplecode/Reachability/Introduction/Intro.html

The Reachability class provides the following values:

ReachableViaCarrierDataNetwork, ReachableViaWiFiNetwork or NotReachable.

like image 105
texmex5 Avatar answered Oct 03 '22 20:10

texmex5


You can differentiate between WiFi and 3G iPads if your app is running on a second generation iPad:

+ (NSString *) iPadModelName 
{
    size_t size;
    sysctlbyname("hw.machine", NULL, &size, NULL, 0);
    char *machine = malloc(size);
    sysctlbyname("hw.machine", machine, &size, NULL, 0);
    NSString *platform = [NSString stringWithCString:machine encoding:NSASCIIStringEncoding];
    free(machine);
    if ([platform isEqualToString:@"iPad2,1"])      return @"iPad 2 (WiFi)";
    if ([platform isEqualToString:@"iPad2,2"])      return @"iPad 2 (GSM)";
    if ([platform isEqualToString:@"iPad2,3"])      return @"iPad 2 (CDMA)";

    return platform;
}
like image 39
Andrey Zverev Avatar answered Oct 03 '22 20:10

Andrey Zverev