How to detect if an iPad has GPS

Hi everyone!

Because of a business requirement, we need to know if the current device has GPS or not so, I have been researching this without any success. We could say that all of the iPhones have a built-in GPS, so this all comes down to the iPads.

I wanted to try to confirm here: Do you know if there is any public API that says if an iOS device has GPS or not?

On the other hand, only the Wifi + Cellular iPads have GPS, the WiFi-Only iPads don't have this. Therefore, we could say something like "If the device has cellular technology, then it has a GPS".

I found this answer in SO which shows how to accomplish the cellular detection: https://stackoverflow.com/questions/7101206/know-if-ios-device-has-cellular-data-capabilities/14507324#14507324

We have been able to test this out on 3 iPads: two WiFi + Cellular models, and the other one a WiFi-Only iPad. The result looks good.

I wanted to ask:

Is this the right way to detect cellular technology? (I do not seem to find detailed information about the "pdp_ip0" interface)

is this a safe way to detect if an iPad has GPS or not?

Thanks in advance!

I can’t answer your main question but I want to address two points. First up, this:

Is this the right way to detect cellular technology?

No. The WWAN interface name (pdp_ipX) is not considered API.

My general advice for getting info about the state of cellular is to use Core Telephony. I don’t have an iPad with cellular to test this on at the moment, but I’m pretty sure that’ll work on iPad as well as iPhone.

Second, this:

Therefore, we could say something like "If the device has cellular technology, then it has a GPS".

would be a mistake. While it might be true today, it’s easy to imagine Apple adding GPS to a device that doesn’t have cellular.

As to your main question, how to detect whether a device is GPS-capable, I’m not aware of any good solution to that, but it’s possible that someone with more experience with location will chime in (my relevant experience here is with networking).

Share and Enjoy

Quinn “The Eskimo!” @ Developer Technical Support @ Apple
let myEmail = "eskimo" + "1" + "@" + "apple.com"

Unfortunately, there is no direct way to query for such a thing. However, some workarounds have been sued in the past. None are perfect. Some to consider:

  • request location and if altitude value is present you have gps.
  • match useragent/device model against a table of known devices with GPS (will need to be maintained)
  • check connection (if on cellular, it will have GPS)

Thanks eskimo.

While the Core Telephony Framework provides APIs to access the carrier data, cellular data state, and so on, this does not seem to provide an API to return if the device is cellular capable or not.

While it might be true today, it’s easy to imagine Apple adding GPS to a device that doesn’t have cellular.

Right, a new device like this would break this implementation. But until then, we would have a hacky way to detect this, which does not seem bad. I also think it's a good moment to think if this is really needed.

Can't you just check the body of the ipad for a microSIM compartment? Only the cellular devices have this. Or check the model number online.

How to detect if an iPad has GPS
 
 
Q