I have implemented LocationManager
and getting update of current location in didUpda开发者_开发知识库teToLocation:
every thing is working fine. Now I want to implement network triangulation, as far as I know that, The location services do this automatically. Just request the 'best accuracy' in your LocationManager
and it will do network triangulation if GPS is not available or stable.
The problem is that I want to get the Location's Provider (GPS, Network), that which Location provider is providing the location. How can I get the Location's Provider Detail in my application.
See my answer here: Corelocation and assisted gps iPhone
That should help you tell the difference between GPS and triangulation.
#import <UIKit/UIKit.h>
#import <CoreLocation/CoreLocation.h>
@interface RootViewController : UIViewController<CLLocationManagerDelegate>
{
CLLocationManager *locationManager;
}
@property (nonatomic, retain) CLLocationManager *locationManager;
@end
The implementation of our view controller is as follows:
#import "RootViewController.h"
#import <objc/runtime.h>
@implementation RootViewController
@synthesize locationManager;
- (void)locationManager:(CLLocationManager *)manager didUpdateToLocation:(CLLocation *)newLocation
{
NSLog(@"Latitude = %f", newLocation.coordinate.latitude);
NSLog(@"Longitude = %f", newLocation.coordinate.longitude);
}
精彩评论