Watchfaces - get a rough current location from the phone?

Hello, I'm a developer of Weathergraph, a weather watchface: https://apps.garmin.com/en-US/apps/2de2ee03-0f81-4668-b885-120def9f07c4

A major inconvenience is that the watchface can only access a location from last activity, so that when my users move, they need to manually do a gps lock to update their weather forecast to a new place. It would be great if there was an API to get a location from a phone (which always knows rough location, and it doesn't cost any battery) - this way, everyone could get an up-to-date forecast all the time.

I'm pretty sure this is what a built-in weather widget does, it seems to always show the data of a latest location. And I think that about year and half ago, it (accidentally? API bug on VA HR?) worked like that - Activity.getActivityInfo().currentLocation actually got an up-to-date phone location, but this disappeared with an update.

Could we get this added into ConnectIQ? It could have a new permission, so that it's clear what the app will be able to access. What do you think?

  • I don't think the current phone location is ever on the watch, and what happens with the native weather widget, is it send the request to GCM, and GCM inserts the phone's location, and then forwards the request to get the weather data 

    Activity.Info.currentLocation has never had the phone's location, but there was a odd drift that did occur that has since been corrected.

    So to do this, you need to request the phone location from your own companion app in a background process, and then do the makeWebRequest with that, or have a companion app that inserts the phone's location in the request to your data provider.

  • Former Member
    0 Former Member

    Jim and I discussed something around this topic lately - I use a different API to retrieve the users location (Toybox.Position.getInfo()) - which doesn't require the user to have started an activity (although I have found that sometimes it will be null - if that's a problem, I did find you can register your watch-face to receive location events - but that can only be done in the background (using Toybox.Timer) and when the watch-face is not in low power mode (started in onExitSleep, stopped onEnterSleep)).

  • Actually, it does require a recent activity or use of GPS, and it will go null if the location has gone "stale" after a period of time.  And as you found out, it doesn't work in a watch face on some devices.  You might be able to use it in a background, but for it to get data, something else must have started GPS in the time before it goes stale.