Issues with recording swimming activity

I'm currently developing custom app for swimming activity. It's going to capture laps, recognize swim style etc. using my own algorithm - not the one delivered by garmin and I'm about to release a beta version to collect user feedback but I have couple issues i would like to solve if possible.

App is build on the top of default swimming activity:

sport=>Activity.SPORT_SWIMMING,
subSport=>Activity.SUB_SPORT_LAP_SWIMMING
1. Once activity is saved the default lap distance in garmin connect is set to 23meters:
It looks like in garmin connect the lap distance is set up as 'custom' by default. I'm handling distance in my metrics by myself but users will see inconsistent distance once synchronized with garmin connect on main activity screen. Is there any way to set by app code the lap distance used by garmin connect for swimming activity?
2. I would like to plot some metrics on graphs shown in garmin connect activity summary but once activity is saved no charts are visible (only the ones delivered by default swimming activity). However if I save activity very early - before default swimming activity captures any metrics/laps - the default charts are not visible but mine are:
Is there any way to force my charts to be displayed? I tried to play around with fitfields id's etc but the behavior is the same.
Thanks in advance for any suggestions.
  • Would be useful to see the fitcontiributions xml.

    Regarding the pool size: what is the pool size set in the default (built-in) swim activity? Is that set to 23m? If yes, then I think this is another side of a bug I saw recently, that is the garmin device somehow confuses between device apps recording with the same activity type as an existing activity profile. In my case I even see in the recorded Hike activities (recorded by my device app) that the CIQ datafields added to the built-in Hike activity are also listed, and they ran, and they recorded fit data.

  • Here is how I define it in fitcontributions file:

    The distance in default swimming activity app is set to 25 meters and once activity is recorded the distance is a multiple of that number and the lap distance is set to 25m when checked in activity edit.

    When I record swimming activity with my app it sets distance setting to "custom" which is 23m by default. I would expect/assume that when I register activity as swimming I would also set the lap distance somehow but have no idea if it is possible.

  • Sounds like this is a bug (or multiple). What device have you tried it on?

  • It was on Fenix7.
    I've just tried to check it on Venu but I cannot sync activity with GC for some reason. However when I save activity with my app and check it on activity history afterwards it shows 50yd while default swimming app is set for 25m.

    (I will update this post once I'm able to sync activities with gc and venu behavior is different than described above..)

  • I've just tried this app: https://apps.garmin.com/pl-PL/apps/b4ea2e83-ec07-4fec-80ad-6b1b67f951d0 (Swim Smooth GURU)

    It looks like this one does not have the problem I described. I've looked at the fitfile generated and it looks like it does introduce "pool_length_unit" datafield which I tried to replicate:

            var pool_length = session.createField(
                "pool_length_unit",
                0,
                FitContributor.DATA_TYPE_UINT8,
                {
                    :mesgType=>FitContributor.MESG_TYPE_SESSION,
                    :count=>1,
                    :nativeNum=> 46

                    }
                );
            pool_length.setData(0);

     It looks like this one tries to replace default native field value but in my case it changed nothing.

    I'm aware that CIQ apps cannot change native fields at the moment but could someone explain me how is it possible the app I'm referencing to made it happen? Is it developed with some kind of partnership with garmin or I'm missing something?

  • Bump, as described above I'm looking for some clues how does it happen that some apps are able to modify native fields?

    Also I've released my app with swimming distance/lap distance issue unresolved (apps.garmin.com/.../0418ef15-69e6-4793-8e4f-d4da33c0367c)

  • I did some digging and pool swim guru doesn't override pool length via nativeNum. nativeNum for pool length is 44 and if you open a FIT file created by pool swim guru, you can see it doesn't write a dev field with that nativeNum, but it actually writes the real pool length field.

    I think the app sets the real pool length using the :poolLength option to ActivityRecording.createSession:

    developer.garmin.com/.../ActivityRecording.html

    :poolLength — (Lang.Float) —

    This is the length of the pool in meters for this activity. If this session object is configured with :sport=>SPORT_SWIMMING and :subSport=>SUB_SPORT_LAP_SWIMMING, this option is required to configure the system in this mode. If it is not provided, activity data may have undefined behavior. For all other sport modes, this option is ignored.

    (I went back to the CIQ 3.2.5 SDK and :poolLength was part of the docs. Plus, *.api.debug.xml for even the oldest devices -- such as fr920xt -- contains this symbol, which isn't used for anything else, so I think it's safe to say this option has been around forever.)

    I tried this by modifying the RecordSample app, and it works as expected.

    _session = ActivityRecording.createSession({:name=>"Pool Swim", :sport=>Activity.SPORT_SWIMMING, :subSport=>Activity.SUB_SPORT_LAP_SWIMMING, :poolLength=>47.0});

  • Thank you a lot for this! Somehow I missed this in documentation and it works. Except It is set up as custom distance in meters and cannot set yards this way but it is better than nothing. Thanks again!

  • I haven't tried this, but I would expect that if you convert the yards to meters and then set it this way, then if the user is set to inperial units then it should be displayed in yards.

  • That was my idea too but I tried it and once activity is saved it is in meters. Also I tried to set yards in default swimming app but it did not change the way my app display the distance