0

I can't find a method to check "GPS-Chip exists in a iDevice"

I want to give user a hint that without GPS the location is less accurate than with GPS

greetings from cloudy germany

Hape42
  • 41
  • 9

3 Answers3

1

Either the device has a Gps chip or not. If not, a hint to the user is not always helpfull, the user would have to buy a new phone to solve the situation.

However there are many other reasons for having that information.

You must distinguish betwenn:
1. device has no Gps
2. current location was not delivered by GPS, but via an alternate locationing provider. (cell tower/ wifi)
3. user has disabled location delivery for you app.

your question was topic 1:
this is solveable by getting the current device modell (via machine name), then look up the modell, and make your own list which device has gps. Look at post from user boxel in detect ipad mini to show the technic.

However this is not future proof and works only for the known models and in generall not very recommended.

Or you state in the plist file of your app that you need a device with Gps, then it will only be installed to such devices.

2) you can look up current speed and course, if valid this is only delivered by GPS or device is not moving. (then you may look up horicontal accuarcy < 30m).

3) was answered by post of anirudcc

Community
  • 1
  • 1
AlexWien
  • 28,470
  • 6
  • 53
  • 83
1

You can use this category which has a function

-(BOOL) supportsCapability: (NSString *) capability;

BOOL hasGPS = [UIDevice supportsCapability:UIDeviceGPSCapability];

I hope it helps.

Or this works as well:

//Use classLoaders to avoid crashes on iPhone OS 3.x
id netInfo = [[NSClassFromString(@"CTTelephonyNetworkInfo") alloc] init];
if (netInfo) 
{
            id carrier = [netInfo subscriberCellularProvider];

            if ([[carrier carrierName] length] <=0)
            {
                    //NO operator=>NO 3G and no real GPS  
            }
}

2nd solution's source:Detect GPS Hardware in iphone

Community
  • 1
  • 1
flatronka
  • 1,061
  • 25
  • 51
-1

Use the locationServicesEnabled method in CLLocationManager

http://developer.apple.com/library/ios/#documentation/CoreLocation/Reference/CLLocationManager_Class/CLLocationManager/CLLocationManager.html#//apple_ref/occ/clm/CLLocationManager/locationServicesEnabled

aniruddhc
  • 320
  • 1
  • 3
  • 15
  • this does not tell whether Gps or cell tower / wifi locationing is used. – AlexWien Jun 03 '13 at 10:09
  • The GPS hardware cannot be detected with the SDK. Please refer to this answer http://stackoverflow.com/questions/2004689/detect-gps-hardware-in-iphone – aniruddhc Jun 03 '13 at 10:33
  • it can be done, but you cannot. look at my answer. you can get the machine name, and from there you create yourself a list which devices have Gps. you need the same technic to detect the iPad mini. I have done that in my app. (if it could not be done then the corect answer would be "it cannot be done") – AlexWien Jun 03 '13 at 10:37
  • bye the way, the link in your comment above shows the answer! – AlexWien Jun 03 '13 at 10:49