Ticket Created
over 4 years ago

WERETECH-10061

Wrong Activity.getActivityInfo().currentLocation on fenix 6 pro

I seems that Activity.getActivityInfo().currentLocation returns a position object with lat/lon coordinates of 0 (zero), instead of returning null.

In watch faces, Activity.getActivityInfo().currentLocation is used to get current or recent GPS position retrieved by GPS fix from last activity.

When GPS fix expired after some time, Activity.getActivityInfo().currentLocation should return null.

But on my fenix 6 pro it seems to return a position object with lat/lon coordinates of 0.

Code used in watch face:

var location;
var locationArray;

location = Activity.getActivityInfo().currentLocation;
if (location != null) {
   locationArray = location.toDegrees();
}
-
On my fenix 6 pro location var is not null and locationArray is [0.000000, 0.000000]
On my forerunner 645 location var is null, which is correct.
Simulator is also correct with fenix 6 (pro).
  • On my Fenix 6 Pro Position does not expire (only by restarting the watch or by the bug described above). Accuracy goes to 1, but the last position is still maintained correctly (i.e. not null or 0 0, or -180 -180) after several days of not having a GPS fix.

  • Position has always expired, but the time before it expired varied by device, from an hour to a number of hours.  When expired, it was null,

  • Hm, I think the question is why did Garmin change the implementation of this. In the past, the position did not expire and you could check the timestamp of the last fix via Position.Info.when.

    Now, if you start an activity and cancel it before you have a gps fix the location is always set to 0, 0 and accuracy is set to 1. That is from my point of view a bug.

    If there is no gps fix there shouldn't be any change on the last known location.

  • In addition, this is what api docs say about position.info class:

    Position Info can be retrieved on every call of onUpdate() or it can be obtained on demand.
    Fields in this class may return null so should be checked for null values prior to use.

  • I agree. 0,0 is valid.  It should be null.