FIT file saved over multiple app exits.

I have custom fit data I'm saving when leaving an app to add too when I restart the app. I'm using application storage to do this. On exiting I have 2 choices either record the .fit file or discard it. What I would like to do is append to the .fit file on returning to the app. I don't want to lose the heart rate data, speed, elevation, etc. all that generic information that's in the file. Is there a way I can prevent the .fit file from recording without discarding it? I'm using Session.start(), .stop and .discard. Not sure what .save() does. Any suggestions, work around welcomed.

1st Start app --- do some stuff creates fit data

     done?

        Yes -- record fit data 

        No -- save fit data for later

2nd Start app

     got fit data?

       yes -- append to it

       no -- create fit data

regards,

Don

  • What I would like to do is append to the .fit file on returning to the app.

    You can't because exiting the app automatically ends the recording session and saves the FIT file.

    I'm using Session.start(), .stop and .discard. Not sure what .save() does.

    stop() pauses the recording and save() saves it (as well as ending the recording session). You'll find that if you try to anything with the session after save() (or discard()), like restart it, you'll get a system error.

    https://developer.garmin.com/connect-iq/core-topics/activity-recording/

    • Use the start() method of the FIT session to begin recording. Data from the enabled sensors will be recorded into the FIT file.
    • Use stop() to pause the recording
    • Use save() to save the recording, or discard() to delete the recording
  • Once you call stop(), there are 3 things you can do

    -start() to resume recording

    -save() or discard() to end the recording

    When a user pushes the proper button, I stop() recording present a menu with the three options of Resume, Save. Discard.

    As soon as my app exits, the activity will get synced to Garmin Connect if auto sync is enabled.

    You can not append to a ,fit file, even if your app exits without a stop()/save()/discard().  It will result in a .fit without the proper ending. 

  • What you're really looking for is a "Resume Later" function that's available in native activities on some device.

    There's no way to do that in CIQ.