Titanium JIRA Archive
Titanium SDK/CLI (TIMOB)

[TIMOB-9187] Ti.map.view add direct access to user's currentlocation

GitHub Issuen/a
TypeNew Feature
PriorityLow
StatusOpen
ResolutionUnresolved
Affected Version/sn/a
Fix Version/sn/a
ComponentsiOS
Labelsapi
ReporterVincent
AssigneeUnknown
Created2012-05-15T04:54:08.000+0000
Updated2018-02-28T20:04:10.000+0000

Description

give access to MKUserLocation location @property(readonly, retain, nonatomic) CLLocation *location from the mapview ( no need to listen for GPS event in a mapview) constraint : @property(readonly, nonatomic, getter=isUpdating) BOOL updating should also be exposed

Comments

  1. Vincent 2012-07-06

    could be also implemented under a new event for the mapview returning a LocationCoordinates object each time the userLocation is updated
  2. Vincent 2012-12-10

    that's what I did
       - (void)mapView:(MKMapView *)mapView didUpdateUserLocation:(MKUserLocation *)userLocation
       {
          
           if ([self.proxy _hasListeners:@"userLocation"])
           {
               CLLocation*   myLocation = [userLocation location];
               CLLocationCoordinate2D coord = [myLocation coordinate];
                 
               NSDictionary * props = @{
               @"latitude":    @(coord.latitude),
               @"longitude":   @(coord.longitude),
               @"heading":     @(myLocation.course ),
               @"timestamp":   @([ myLocation.timestamp timeIntervalSince1970] * 1000 ),
               };
               
               [self.proxy fireEvent:@"userLocation" withObject:props];
               
           }
           
           
       }
       

JSON Source