Toybox::Activity::Info and 'has'

Does the Toybox::Activity::Info class always have all the attributes listed in the API docs or only the attributes for sensors attached? In other words, is it necessary to use 'has' before accessing any particular attribute like 'currentSpeed' in the event the speed sensor is not attached? Seems like it is necessary but don't see it documented.
  • Many of the fields in Activity::Info are only available on some devices. For example, the documentation for averagePower notes that the field is supported on some devices, and explicitly lists the devices there. That said, the documentation isn't perfect in this respect. The simulator should behave properly for these cases though. If you try to access the averagePower field on the simulated vivoactive, the field will not be there, but if you run the same code on a simulated edge1000, it should. If you are trying to write your code for maximum portability, you should use has.

    Travis
  • Even if you use fields that are available on all devices, (and don't need "has") you want to do "null checks" on the fields, as some will be null until recording starts, some may be null based on the sport, etc.