How to use the persistLocation() function for saving a location from inside a widget

I'd like to be able to save the current location to the fenix 3 location list from inside my widget and looking through the API documentation I see the Toybox::PersistedLocations module which has a persistLocation function described as follows:

- (Object) persistLocation(location, options)

Save a location to the device's location list

Parameters:
location (Location) — Location object to persist
options (Dictionary) — Dictionary of options, or null to accept defaults
:name (Hash) — a customizable set of options


I'd be interested to know what is the correct syntax when calling this function? I'm thinking to call this as below from my view but not clear what options I can pass and how can I add a location name when saving the location?

[FONT=Courier New]var location_variable = info.position;
PesistedLocations.persistLocation(location_variable, ???);[/FONT]


Thanks very much!
  • ??? should be {:name => "Location Name"}.
  • PersistedLocations API

    ??? should be {:name => "Location Name"}.


    Hi,

    What is the behaviour of this method? Does it overwrite waypoints, if the waypoint with the specified name already exists?

    I would like to write an app around waypoints to fix important features missing in Fenix 3. If possible, please ask the team to allow us read, insert, and update waypoints in the watch internal database.

    Thanks,
    David