ActivityRecording and Sensors

Hi,

I've been developing and testing an App, and wanted to clarify some detail about ActivityRecording and Sensors. My understanding is that sensors like Heart Rate and Cadence/Speed automatically connect and get recorded without and developer effort.

However, for GPS you need to call Position.enableLocationEvents(Position.LOCATION_CONTINUOUS,...) to get the 'sensor' enabled and recorded. Is this correct?

Can I also call (mid-session) Position.enableLocationEvents(Position.LOCATION_DISABLE, ...) to stop recording, if I know they are indoors to save battery?

Also, is it acceptable to call Position.enableLocationEvents(Position.LOCATION_CONTINUOUS, ...) with a null function pointer, as I don't want the callback - just the data recorded?

Thanks
Chris
  • Hi,

    I've been developing and testing an App, and wanted to clarify some detail about ActivityRecording and Sensors. My understanding is that sensors like Heart Rate and Cadence/Speed automatically connect and get recorded without and developer effort.


    You have to enable the sensors you want. The only exception I've seen is cadence, where you'll get it from the watch itself and not the food pod. To enable them, use something like:
    var sensors=Sensor.setEnabledSensors( [Sensor.SENSOR_HEARTRATE,Sensor.SENSOR_TEMPERATURE,Sensor.SENSOR_FOOTPOD] );


    However, for GPS you need to call Position.enableLocationEvents(Position.LOCATION_CONTINUOUS,...) to get the 'sensor' enabled and recorded. Is this correct?

    yes
    Can I also call (mid-session) Position.enableLocationEvents(Position.LOCATION_DISABLE, ...) to stop recording, if I know they are indoors to save battery?

    Also, is it acceptable to call Position.enableLocationEvents(Position.LOCATION_CONTINUOUS, ...) with a null function pointer, as I don't want the callback - just the data recorded?
    Thanks
    Chris

    I've never tried turning off GPS during a recording, but I wonder how that would look in Garmin Connect for the activity. You could try it, but it might not work, as the FW is already doing it's thing with the recording, and not sure you can just stop that part in the middle.

    And never tried using null for the call back. But if the null doesn't work, just use an onPosition() that doesn't do anything.

    Oh, another note on sensors. When you enable them, you get back which sensors have been paired with the watch, but not what's currently connected. So for example, if you'd paired a Tempe, you'll see that the system knows about a Tempe, but that Tempe could have a dead battery. For seeing what's there for the Tempe and HRM, the easiest way to check is look at the data (I use Sensor.Info) and see if you're getting any data.
  • I can turn on and off the GPS midday. The FW is now fixed for the F3 at least.

    When uploaded. Between the on and the off and the on again position, you will see a straight "as the crow flies" path
  • I can turn on and off the GPS midday. The FW is now fixed for the F3 at least.

    When uploaded. Between the on and the off and the on again position, you will see a straight "as the crow flies" path


    I see the same thing as far as GPS - when I "pause" - stop the fit recording, and then start it again later, it just connects the last two GPS locations from when it was recording.