If Location.getinfo returns 0 how to get last known position?

If I call getinfo and a accuracy of 0 how can I get the last known position?

ta
  • According to the documentation, the accuracy member is one of the enum values...

    module Position {

    enum {
    QUALITY_NOT_AVAILABLE = 0, // GPS is not available
    QUALITY_LAST_KNOWN = 1, // The Location is based on the last known GPS fix
    QUALITY_POOR = 2, // The Location was calculated with a poor GPS fix
    QUALITY_USABLE = 3, // The Location was calculated with a usable GPS fix
    QUALITY_GOOD = 4 // The Location was calculated with a good GPS fix
    }

    }


    If you get the value 0 (QUALITY_NOT_AVAILABLE), then GPS position data is not available. If you want GPS position data after that, then you have to request it via a call to Position.enableLocationEvents(Position.LOCATION_ONE_SHOT, self.method(:onPosition)).

    Travis
  • In my own testing using LOCATION_ONE_SHOT is the way to do this even in a widget and is fairly fast, as even there, in onPosition, you'll only see QUALITY_LAST_KNOWN for maybe an hour after the last time GPS was used on the watch.. LOCATION_ONE_SHOT give you your real location.