Help creating waypoints

If I'm correct, when recording an activity, it's possible to create a waypoint in the current activity file. I'm hoping this waypoint will appear in the activity file that I can download from Garmin Connect as a gpx file.
Is this right? If so....

It seems to be using persisted Content which is all pretty obscure to me from the programmers guide.
Could someone give me a leg up on this please?
I have a session:
$.session = Record.createSession({ :name => "raceQs racing", :sport => Record.SPORT_GENERIC });
$.session.start();
When my user presses a button, I would like to record the current location as a waypoint with a specific name.

I have the current location object.

Could you show me the code for this please?
Many thanks
  • I've put the code into my app, and get the same error:
    I have the libraries (using Toybox.PersistedContent as PersistedContent;).
    My Location object looks good:
    System.println("New Position: "+mlocation.toGeoString(Position.GEO_DMS));
    returns
    New Position: S 33?46'47.40"E151?11'10.44"
    but...
    PersistedContent.saveWaypoint(mlocation, options); crashes
    ERROR: Symbol Not Found Error.

    Both in Sim and on VA-HR
    Does PersistedContent need permissions other than id "Fit"?
  • I didn't want to speculate before (although I had a hunch), so I tried it in the sim myself. It works on FR735, FR935 but not Vivoactive HR.

    I think the documentation for PersistedContent has a typo (and/or is unclear):

    Supported Devices:
    • All devices execept Approach S60
    • vivoactive
    • vivoactive HR
    The way it's formatted, it seems like saveWaypoint is supported by all device except S60, and they are also supported by VA and VAHR. But it wouldn't really make sense for them to say that, since all devices includes VA and VAHR (it would be redundant.).

    Besides, the VA doesn't support 2.2, so the list doesn't really make sense for that additional reason. (Since PersistedContent is for 2.2 and higher)

    (I'm guessing it's copy/pasted from the PersistedLocations doc, which has been around since 1.0.2)

    So it seems to me they really meant to write:

    Supported Devices:

    - All devices except Approach S60, vivoactive, vivoactive HR.


    BTW, if it had failed due to permissions, the sim would've said so. And yes, you do need permissions for positioning and persisted content. Note that you don't need Positioning permission to get your currentLocation from ActivityInfo, so current location (and start location) work in a datafield.

    Anyway, it seems like for all devices except Approach S60, VA and VAHR:

    CIQ1: Use PersistedLocations
    CIQ2: Use PersistedContent

    (I tried VA with PersistedLocations, and it doesn't work. FR235 does work with PersistedLocations).
  • When I run in the sim on a fenix 5, (which is not in the exclusion list.) I get
    Permission requiredFailed invoking <symbol>Permission Required
    But I can't find a guide to the syntax of the permission.
    I tried
    iq:uses-permission id=" PersistedContent" and "Persisted Content" without success
    What is required???


    To create a new Position, rather than just look at currentLocation and startLocation in activityInfo, I think you need the positioning permission as well.

    It might be easier to use the project settings in eclipse. Right-click on project > Properties > Connect IQ.

    Here's the manifest.xml snippet:
    <iq:permissions>
    <iq:uses-permission id="Positioning"/>
    <iq:uses-permission id="PersistedContent"/>
    <iq:uses-permission id="PersistedLocations"/>
    </iq:permissions>


    You only need PersistedLocations if you need to support CIQ1.
  • OK, Working on fenix5 with "PersistedContent" permission, but fails on VA-HR. What a weird situation.
  • Cool.

    Yeah, I think it's just awkward documentation, unless I'm totally missing something. There's really no reason to say "Supported on All Devices except Approach, and BTW also supported on VA/VAHR."

    I filed a report in the CIQ bug forum so maybe we'll know for sure soon.
  • I don't think you can get coordinates from waypoints. I think the point of PersistedContent is to launch the associated apps:
    https://developer.garmin.com/connect...stedcontent2.2


    Ooh, that's bad news, I was thinking about writing a widget showing something like a radar map of all saved waypoints. Therefore I would need to read their coordinates :(

    --- Image ---
  • Yes that would be neat, but I'm pretty sure you can't access the details - I can't see any function that would do that.
  • Yes that would be neat...


    Maybe it could be implemented in future SDK releases?! I don't see a reason to block reading such (user specific) information, like the waypoint coordinates or profile settings (e.g. virtual partner pace) which could be usable for different kind of apps. If needed, an additional permission could be invented for such calls. For me it seems to be more critical to allow creating (even thousands of) new waypoints - but this is no feature request to block this function... ;)


  • I think I first asked for about getting info such as lat/lon back when PresistantLocations was all that was available, and again with Waypoints when PersistantContent came out.

    It would be nice, but this came up back in the CIQ 1.x/early 2.x days. My apps with waypoints just manage their own in the object store. If a change like this comes, I doubt it will be soon. (3.x.x?) This isn't just a CIQ change, but the FW folks on all the devices would have to make the info available to the CIQ VM.