Tuesday, 13 May 2014

Get current Location using googlemaps

[GMSServices provideAPIKey:@"AIzaSyAemkuHXhydxhR286ECVVtspCVTstmgBQM"]; // This key is used for Google Maps.

    // Codes to start tracking the location of the user.
    locationManager = [[CLLocationManager alloc] init];
    locationManager.delegate = self;
    locationManager.distanceFilter = kCLDistanceFilterNone;
    locationManager.desiredAccuracy = kCLLocationAccuracyBest;
    [locationManager startUpdatingLocation];
    return YES;
}

- (void)locationManager:(CLLocationManager *)manager
     didUpdateLocations:(NSArray *)locations {
    CLLocation *clLocation = [locations lastObject];
    NSLog(@"Current latitude %f",clLocation.coordinate.latitude);
    NSLog(@"Current longitude %f",clLocation.coordinate.longitude);

}


Refer:https://developers.google.com/maps/documentation/ios/start

No comments:

Post a Comment