Acknowledged
CIQQA-4279

getUserActivityHistory is too slow on FR970, firmware 17.33

My watch face uses the API `getUserActivityHistory` to show the monthly running distance, but the API is too slow on FR970, firmware 17.33. 

On the user's FR970, it took 1853 ms to read 180 records.  The user confirmed that his FR255 works fine. 

Here is the complete code to read the activities.

function onShow() as Void {
        mReadTime = System.getTimer();
        mActivities = [] as Array<String>;
        if (UserProfile has :getUserActivityHistory) {
            var itr = UserProfile.getUserActivityHistory();
            if(itr != null){
                var next = itr.next();
                var start = Time.today().value();
                
                while (next != null) {
                    if (next.startTime != null) {
                        // https://forums.garmin.com/developer/connect-iq/f/discussion/356000/weekly-running-distance
                        var time = (next.startTime as Moment);
                        var value = time.value();
                        if ((start - value) > 315576000) { // 10 years
                            time = new Time.Moment(value + 631065600);
                        }
                        var info = Time.Gregorian.info(time, Time.FORMAT_SHORT);
                        
                        mActivities.add(Lang.format("$1$$2$$3$ $4$:$5$", [(info.year % 1000).format("%02d"), (info.month as Number).format("%02d"), info.day.format("%02d"), info.hour.format("%02d"), info.min.format("%02d")]));
                        mActivities.add((next.type as Number).toString());
                        mActivities.add((next.distance as Number).toString());
                    }
                    next = itr.next();
                }
            }
        }
        else {
            mActivities.add("The API\ngetUserActivityHistory\nis not available.");
        }
        mReadTime = System.getTimer() - mReadTime;
}

  • I've been receiving reports, particularly from Fenix 8 users (all subtypes), that watch faces have been responding extremely slowly to inputs (wake up gestures, menu scrolling, etc.) since a specific firmware version.
    With one user I could do some further tests and we were able to definitively trace the issue to the "Running Distance" field, where activity data is read, similar to how frinkr describes it.

    So some more watches might be affected by this problem.