How to Tell If an iOS Device Has a Gps

How can I tell if an iOS device has a GPS?

For iOS 6 or higher, you might want to try

+ (BOOL)[CLLocationManager deferredLocationUpdatesAvailable]

According to the documentation:

Deferred location updates require the presence of GPS hardware and may not be supported on all iOS devices.

Detect GPS Hardware in iphone

Even though you can not determine this using the SDK, you may exploit your knowledge of current models. If you limit yourself to iPhone 3G, iPhone 3GS and iPod Touch 2nd generation (I do not personally support older iPhone edge or iPod Touch 1st generation), then you already know that the iPhone models ship with a real AGPS unit while the iPod Touch 2nd generation can use - if and when available - geotagged wifi hot spots. You may then use the following method to determine the model you are running on:

- (NSString *) deviceModel{
size_t size;
sysctlbyname("hw.machine", NULL, &size, NULL, 0);
char *answer = malloc(size);
sysctlbyname("hw.machine", answer, &size, NULL, 0);
NSString *results = [NSString stringWithCString:answer encoding: NSUTF8StringEncoding];
free(answer);
return results;
}

The method returns @"iPhone2,1" for the 3GS, @"iPhone1,2" for the 3G and @"iPod2,1" for the ipod touch 2nd generation; you call it as follows

NSString *deviceModel = [[self deviceModel] retain];

and use it as follows:

if([self.deviceModel isEqualToString:@"Pod2,1"]){
// no real GPS unit available
// no camera available
...
}

Detect GPS in iOS device with CoreTelephony

After doing some digging, I've found this article from Apple which, as a footnote, explains that:

  • iOS devices without a cellular connection use only Wi-Fi for Location Services (if a Wi-Fi network is available).

  • GPS is available [only] on iPhone and iPad Wi-Fi + 3G models.

So it seems that detecting a cellular connection is a reliable way to determine whether or not and iOS device has a GPS unit. No cellular connection, no GPS.

Note that iOS supports external GPS units through bluetooth and dock connector. The above methods will tell whether the device has a internal GPS but not whether LocationManager will be able to provide GPS driven location updates.



Related Topics



Leave a reply



Submit