I want to allow only users with a 3G phone to use a particular GPS function. How do I run a check on the device before allowing that feature to be used?
views:
281answers:
3
+2
Q:
How can I disallow use of a application feature based on if the device is a 3G or Non-3G device?
+3
A:
The following code with allow you to determine the exact device that is in use but I would first consider the fact that a 3G device may not actually be able to obtain a GPS lock as the process of doing so is quite slow and requires a more or less clear view of the sky.
For an iPhone 3G the result of this method will be iPhone1,2
- (NSString *)deviceModel
{
NSString *deviceModel = nil;
char buffer[32];
size_t length = sizeof(buffer);
if (sysctlbyname("hw.machine", &buffer, &length, NULL, 0) == 0) {
deviceModel = [[NSString alloc] initWithCString:buffer encoding:NSASCIIStringEncoding];
}
return [deviceModel autorelease];
}
wisequark
2008-11-19 22:22:51
A:
Why would you stop 1g phone users from using location services? If you are near mapped WiFi you can get decent location results even without a GPS on the device.
Instead you should base your choice of what to do around the current location accuracy, if that is a reason why you seek to disable anything.
Kendall Helmstetter Gelner
2010-03-21 05:38:28