iPhone: evaluate the strength of GPS signal
GPS in IOS applications can work properly only if it has a good signal. In the application it is necessary to detect as the signal is strong.
The strength from the GPS signal you can check from variable type CLLocation. In this example we modify method – (void)locationManager:(CLLocationManager *)manager…:
Objective-C
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 |
#define GPS_POOR_SIGNAL = 163; #define GPS_AVERAGE_SIGNAL = 48; - (void)locationManager:(CLLocationManager *)manager didUpdateToLocation:(CLLocation *)newLocation fromLocation:(CLLocation *)oldLocation { if (newLocation.horizontalAccuracy < 0){ NSLog(@"no signal"); } else if (newLocation.horizontalAccuracy > GPS_POOR_SIGNAL){ NSLog(@"poor signal"); } else if (newLocation.horizontalAccuracy > GPS_AVERAGE_SIGNAL){ NSLog(@"average signal"); } else{ NSLog(@"full signal"); } } |
Posted on 9 August 2013