See also the discussion at https://forums.garmin.com/developer/connect-iq/f/discussion/283469/addlap-calls-don-t-match-laps-in-connect for more context.
When an ActivityRecording session is created with this code:
Session = ActivityRecording.createSession({
:name=>"Wading",
:sport=>ActivityRecording.SPORT_SWIMMING,
:subSport=>ActivityRecording.SUB_SPORT_LAPSWIMMING,
:poolLength=>50.0
});
and followed up with calls to Session.addLap(),
nominally at the completion of a lap (two lengths, therefore returning to the starting point), laps are incorrectly recorded for the activity. Some laps are recorded at 100% of a lap length, some at 150% and some at 200%.
In each case the call to addLap()
returns true
, which (as documented) confirms that the lap has been recorded. This disconnect causes the activity to be incorrectly recorded and measured - for example, instead of 20 laps and 2km, I see 10 laps and 1350m for one example.
The same code records lap counts correctly when using the Sport "Running" or "Hiking", in each case with the sub-sport "Generic".
At this point I'm developing with:
- IDE: VS Code (current, previous two versions also produce the same result) on Windows 11
- SDK: 4.06 and 4.07 both tested, 4.07 current
- JDK: AdoptOpenJDK jdk-8.0.282.8
- Device: Venu 2 (update check says no updates available, SW version 5.38, CIQSystem 4, API level 4.0.6)
Happy to provide live code off-forum, although the live code includes lots of other complexity.