Advertise here




Advertise here

Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

Get every location update from GPS

IMpossibleIMpossible Posts: 2
edited May 2013 in iOS SDK Development
I am new to iOS. I am making one app using GPS location update. I am fetching current location and update location to server. I want to get every change in meter and update it to server. Here is the code i am using:
locationManager = [[CLLocationManager alloc] init] ;
 locationManager.delegate = self; // send loc updates to myself
 locationManager.distanceFilter = 1.0f; // whenever we move
 locationManager.desiredAccuracy = kCLLocationAccuracyBest;
 [locationManager startUpdatingLocation];

But the location is not updating after every meter. It updates but not regularly. It updates about 7 to 10 meters and it is also not regurely.

Thanks for Help!

Replies

  • ilohimilohim Posts: 15 *
    Normally it should works like that :
    locationManager = [[CLLocationManager alloc] init] ;
    locationManager.delegate = self;
    locationManager.desiredAccuracy = kCLLocationAccuracyBest; or kCLLocationAccuracyKilometer but this is not less precise
    locationManager.distanceFilter = 1.;
    [locationManager startUpdatingLocation];
  • ilohimilohim Posts: 15 *
    kCLLocationAccuracyKilometer but this is less precise* little mistake
  • ilohimilohim Posts: 15 *
    You have some constants in the framwork Core Location :
    -kCLLocationAccuracyBestForNavigation : "Use the highest possible accuracy and combine it with additional sensor data. This level of accuracy is intended for use in navigation applications that require precise position information at all times and are intended to be used only while the device is plugged in." but it desn't works with IOS4<

    - kCLLocationAccuracyBest : this is the best as precise as possible, but it's not 1 meter it can be plus it depends ..
    -kCLLocationAccuracyNearestTenMeters : this is a position every ten meters
    - kCLLocationAccuracyHundredMeters : so every hundred meters
    - kCLLocationAccuracyKilometer : every kilometer
    - kCLLocationAccuracyThreeKilometer : every 3 kilometers

  • Duncan CDuncan C Posts: 9,114 @ @ @ @ @ @ @

    I am new to iOS. I am making one app using GPS location update. I am fetching current location and update location to server. I want to get every change in meter and update it to server. Here is the code i am using:

    locationManager = [[CLLocationManager alloc] init] ;
     locationManager.delegate = self; // send loc updates to myself
     locationManager.distanceFilter = 1.0f; // whenever we move
     locationManager.desiredAccuracy = kCLLocationAccuracyBest;
     [locationManager startUpdatingLocation];

    But the location is not updating after every meter. It updates but not regularly. It updates about 7 to 10 meters and it is also not regurely.

    Thanks for Help!
    The GPSs in iOS devices are not great. You can ask for updates every meter, but probably won't get that.

    The kCLLocationAccuracyBestForNavigation would be worth trying, but it sounds like it will drain the user's battery quickly.
    Regards,
    Duncan C
    WareTo

    widehead.gif
    Animated GIF created with Face Dancer, available for free in the app store.

    I'm available for one-on-one help at CodeMentor
  • IMpossibleIMpossible Posts: 2
    Duncan C i have tried kCLLocationAccuracyBestForNavigation but it also not to much reliable. If i cant get accurate location for 1 meter than can you please guide me after how much meter i expect a new location?
  • Duncan CDuncan C Posts: 9,114 @ @ @ @ @ @ @
    Dunno. I'd have to run tests just like you would. I remember getting updates around every 3 meters, but that was on iOS 3.2, on iPhone 3G and 3Gs devices.
    Regards,
    Duncan C
    WareTo

    widehead.gif
    Animated GIF created with Face Dancer, available for free in the app store.

    I'm available for one-on-one help at CodeMentor
Sign In or Register to comment.