System.exist() for widget?

Hi guys,

for an app I have a nice feature that allows it to long press the "back" button to exit the app immediately, regardless of the navigation depth. The same feature does not work for widgets, as the "exit" method seems to not do anything. Is there a reason behind that? Requested behavior should be that the method takes the user back to the watch face, so basically the same that happened after the timeout of a widget.

Thanks!

Bye

Top Replies

All Replies

  • Is there genuinely no way to programatically exit a widget? And calling WatchUI.popView(...) from the base view also doesn't work? This seems quite ridiculous.

  • I recall talking to one of the Garmin folks early in CIQ and he explained that the normal exit for a regular widget was to return to the watch face, and the thing  is, CIQ doesn't know which one.  This is why you need to use the default exit, as the FW knows.  There's probably some posts about this here from the early days.

    I just let widgets time out or keep the logic for the back button.  You also want to work the same way other similar apps do.

  • I'm developing for an Edge device and have never owned a Garmin watch, so I can't really speak to the behaviour there. On an Edge device when you're in a widget and you hit the back button, you're returned to the previous menu, as you would expect. I can't fathom why calling WatchUI.popView doesn't just match this behaviour. As I say I don't own a Garmin watch, and don't really know how the UI works there, but it seems to me that popView should just do whatever pressing the back button does? Maybe this doesn't make sense for some reason in the watch context, fine, but why then inflict this restriction on the Edge devices too, where there is a clear logical course of action when popping the base view. The same applies to System.exit in this situation; it's obvious that when the selected widget exits it should just return to the previous menu.


  • Do you see any other widgets (native or CIQ) that do what you are talking about?  I have watches as well as Edge devices, and the only odd thing about edges is that when you start a widget on one, they don't time out as they do on watches with a watch face.

  • Every widget I've ever used returns to the previous menu when you press the back button, yeah. Any other behaviour would be very weird.

    My actual problem is in replicating this exact behaviour. Because you can't use certain views, in my case Menu2, as the base view in a widget, I push it on to the stack and have it do its thing as I want, with the initial base view just being a do nothing view. Now when I press back I want to skip going back to this redundant view and exit the widget without having to press back twice.

  • I understand exactly what you are talking about and what you are trying to do.

    I have a widget that starts up GPS, gets the location, and then uses MapView to show that location on a map.  Using back will exit the map, but I then have a screen in my main view instructing users to press back again to exit the widget.

    This may have been the case of why I asked the Garmin guy about a cleaner way to exit years ago.  But I also understand what's involved and don't expect this to change

  • Understood, I'm just having a rant here really. It seems like a trivially simple thing to want it to do. Oh well.