'$.Toybox.ActivityRecording.SPORT_CYCLING' is deprecated.

I'm experiencing a build issue when using activityrecording module. Every kind of sport i use i got the same message:

'$.Toybox.ActivityRecording.SPORT_CYCLING' is deprecated. examples into sdk documentation use :sport and :subsport but i cannot...

Where am i wrong?

thank you very much

  • If you aren't using the 4.1.7 SDK, try that.  This is in the change log for 4.1.7

    • Do not error when using -l 3 and the warning is due to using a deprecated function.

    What does your call to ActivityRecording.createSession() look like? What is the target device you are trying?

  • The active sdk is the 4.1.7, the target device is a fenix 5x plus. Even the example of the docum sdk is giving built error. I must say that at the end it compile (with the warning), i push to the device and it works. 

                    RECsession = ActivityRecording.createSession({          // set up recording session
                            :name=>"Spinning Session",                      // set session name
                            :sport=>ActivityRecording.SPORT_CYCLING,         // set sport type
                            :subSport=>ActivityRecording.SUB_SPORT_SPIN     // set sub sport type
                    });
  • I'm thinking it's SUB_SPORT_SPIN that's causing the warning.  What happens if instead you use SUB_SPORT_GENERIC

    Then try using the number 5 instead of SUB_SPORT_SPIN

  • Looking at the docs and reading between the lines (bc Garmin never explicitly spells this stuff out), it looks like they want you to use the new Activity.Sport and Activity.SubSport enums, instead of the old ActivityRecording.Sport and ActivityRecording.SubSport enums.

    The new enums are supersets of the old enums, and they're marked as "since 3.2.0". It's funny bc I see two possibilities:

    1) The new enums can't be used with old devices, which means that the compiler is once again preventing us from using a deprecated function/enum which is actually necessary for old devices (this kind of thing has come up before)

    2) The new enums *can* be used with old devices (as long as you don't use the new values) -- in this case, why not expand the old enums instead? Obviously the reason is that the new values in the new enums will only work for new devices. Which circles back to the argument that Garmin shouldn't prevent people from using "deprecated" stuff which is actually necessary for old devices.

    IOW, Garmin needs to find a way to deprecate stuff only for newer devices, and allow us to continue to use the same stuff for old devices. In this case you probably have the workaround of using the new enums or hardcoding the integer values, but it's not ideal.

    https://developer.garmin.com/connect-iq/api-docs/Toybox/ActivityRecording.html#createSession-instance_function

    https://developer.garmin.com/connect-iq/api-docs/Toybox/Activity.html#Sport-module

  • I'm thinking it's SUB_SPORT_SPIN that's causing the warning.  What happens if instead you use SUB_SPORT_GENERIC

    Then try using the number 5 instead of SUB_SPORT_SPIN

    1) SUB_SPORT_SPIN is explicitly documented as a sub sport for cycling

    2) That explanation doesn't make sense given that the message says ActivityRecording.SPORT_CYCLING is deprecated

  • Thank you very much for the precious info. I will try to change activityrecording with activity.sport and add a subsport to see what will happen. i hate running after the different models, font differs, enum differs, screen obviusly too... 

  • Hello!

    I have the same interrogations. Do you now know which of your two hypothesis is the good one?

    I'm developing a badminton application, and I'm supporting devices with API level >3.1.0. In ConnectIQ version 4.1.6, they included the "Racket" sport and the "Badminton" subsport in the new Activity enum.

    So it looks like I now have to check that the new enum exists AND that it contains SUB_SPORT_BADMINTON OR fallback to SUB_SPORT_GENERIC in the Activity enum OR fallback again to SUB_SPORT_GENERIC in the ActivityRecording enum. Why didn't they add the new Activity enum for all versions (even if not all sports and subsports are available to all versions)?
    I tried in the simulator, and it seems the new enum is supported by old devices. But will it work on the real devices?
  • For those who are interested, I wrote a test to answer some questions. It is available here: github.com/.../IQTest.mc