我已實施LocationManager
並獲取當前位置的更新didUpdateToLocation:
每件事情都正常工作。現在我想實現網絡三角測量,據我所知,位置服務自動執行此操作。只需在您的LocationManager
中請求「最佳準確度」,並且如果GPS不可用或不穩定,它將執行網絡三角測量。獲取當前位置的提供者詳細信息在iPhone
問題是我想獲取位置提供者(GPS,網絡),哪個位置提供者正在提供位置。如何在我的應用程序中獲取位置的提供者詳細信息。
我已實施LocationManager
並獲取當前位置的更新didUpdateToLocation:
每件事情都正常工作。現在我想實現網絡三角測量,據我所知,位置服務自動執行此操作。只需在您的LocationManager
中請求「最佳準確度」,並且如果GPS不可用或不穩定,它將執行網絡三角測量。獲取當前位置的提供者詳細信息在iPhone
問題是我想獲取位置提供者(GPS,網絡),哪個位置提供者正在提供位置。如何在我的應用程序中獲取位置的提供者詳細信息。
見我的答案在這裏:Corelocation and assisted gps iPhone
這將有助於你告訴GPS和三角測量之間的差異。
#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);
}
我們如何知道當前位置來自GPS或網絡? – Siddiqui 2011-05-10 11:48:12