Store Location info

I want to create a watch app to collect location data (Lat, Lon, time) in array of such dictionaries, store it on the watch and when the internet connection is available send it to the server. 

Firstly I implemented storing location data to the Application.Storage. But the app started crushing after 400 records (or so).

Then I started exploring how to work with ActivityRecording and sessions, but haven't tried yet. Could be that an option?

Maybe there are better ideas?

If there are any examples I would be very thankful for that.

  • The easiest way to do this is to record a fit file,  To see the results, just use something like the native "walk" activity.  If you want the basics of how that works and how to code it, look at the recordsample in the SDK.  The fit will be synced with garmin connect automatically.

    If you want to save this to Storage yourself, it needs to be a bit smarter.  Like only save it if X time has passed since the last save, or only if the location has changed Y feet since the last time it was saved.  Then you must also manage sending the data yourself (to a non-garmin server) and that also means posting your own Privacy Policy for your app.

    Doing a fit file would be easier.

    Understand that in both cases, having GPS on for extended time will impact the battery

  • Okay, thanks for the answer, I'll try to do that both ways.

    By the way, can I retrieve the location data from Activity data on the flight while a session is still tunning?

  • No, but while you are recording you can display data withing your app for a breadcrumb trail or a actuall map on devices with maps.

    See https://apps.garmin.com/en-US/apps/116a5b59-29ae-4397-a70e-907d7e5f8e44

    On devices with maps, and MapTrackView, you not only see the map as well as the track without saving anything extra within your app.  For breadcrumbs, I save them in an array, and not in Storage.  The breadcrumb version takes more memory than the map version due to this.