Navigate to a geo location from a widget

I have a geo-location with latitude and longitude and I want to either add this location to the current course or launch a new navigation session to this location. I wasn't able to find any Toybox API for it. Is this possible?

I thought maybe with an Intent? If this is not possible, can I at least store this location into user's favorites? Any help is appreciated 
Pray

  • Without having done this myself, I can think of two ways:

    1) Generate a location .FIT file on a server and use makeWebRequest to pull it down. Hopefully makeWebRequest will convert this to a PersistedContent waypoint. You can should be able to launch navigation to this location by using PersistedContent.toIntent(), but you won't be able to read the coordinates in your app.

    2) Generate the coordinates to a location on a server (and use makeWebRequest to pull it down as text or JSON), hardcode the coordinates in your app, or accept coordinates as user input.

    Use PersistedContent.saveWaypoint() to save the coordinates as a named waypoint (as above, you should be able launch navigation to this location using toIntent()). You can also do whatever you want with the coordinates in your app. (e.g. Save them to storage so that the app can retrieve the coordinates later, display them in a list of locations, and allow the user to select a location to navigate to.)

    I don't think you can add the location to the current course (i.e. an existing native navigation session).

  • Thank you, buddy! I went with the "saveWaypoint()" option and it worked in the Simulator and on Edge1040 quite well.

    On rather older Fenix 5X Plus the app crashes while calling System.exitTo(intent), although the device can navigate to the saved waypoint via Navigation -> Saved Locations manually. Do you eventually know why it fails and where it can be fixed? The error is:

    Error: Unhandled Exception
    Time: 2025-01-04T10:05:46Z
    Part-Number: 006-B3111-00
    Firmware-Version: '19.30'
    Language-Code: eng
    ConnectIQ-Version: 5.0.2
    Filename: myapp
    Appname: 'myapp'
    Stack:
      - pc: 0x1000042c
    File: '/Users/sergej/Projects/garmin/myapp/source/WearableApp.mc'
    Line: 52
    Function: onPhoneAppMessage

    At the moment I use connectIq.sendMessage() method for sending data to the wearable app. The data can be sent successfully, but the wearable app can only pickup the data when it's explicitly started by the user. I also wonder if it is possible to forcibly launch an app from a connected mobile device, so it can pickup and process data as soon as it is received?

  • I also wonder if it is possible to forcibly launch an app from a connected mobile device, so it can pickup and process data as soon as it is received?

    No.

    That’s kind of against the philosophy of how Garmin sees IQ apps working (apps being secondary to the regular functions of the watch).

    It would probably be a mess anyway: no one is going to want multiple apps being launched from a phone “randomly”.