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

  • You're right. Sys.exit() isn't available in a widget. I ran into this a while back.

    What you can try if you are x levels deep in views is use popView calls to get back to the main view, where the user then exits normally with a button/swipe.
  • Thanks for the confirmation Jim!

    Is there a reason behind the fact, that this method is not available in a widget?

    Bye
  • If you call System.exit(), the app is supposed to exit. In the case of a widget, exiting would theoretically return the user to the widget loop. If it were to do this, what widget should be displayed? Or maybe the user should be dropped at the clock page?

    Even if we decided on a behavior, it wouldn't work on a device until the device firmware had integrated. This would cause headaches as developers would be leaning on System.exit() to do something, but it wouldn't behave that way on all devices. In the end, we decided that changing the behavior of System.exit() was not worth it.
  • Hi Travis,

    thanks for your explanation!

    For me the behavior is not that "unclear". Basically 2 things can happen upon exit:

    1. Returning to the widget loop showing the widget that was entered before
    2. Returning to the watch face (in my opinion makes most sense)

    We have to keep in mind that "System.exit" is something a developer calls in his app and basically wants it to be closed. For a widget this means for me that I want to get completely out of it jumping to the watch face which, theoretically, is the first "widget" in the loop :)

    The argument about firmware integration is one that you can use for every new feature. Why integrating it when it is only available after all the firmwares for all devices are updated...

    It is not that crucial for me to have this logic in my widget, as it anyways has only one additional screen (except the widget loop screen), but I think for consistency reasons the method should work the same way in apps, widgets and data fields.

    Bye
  • If you call System.exit(), the app is supposed to exit. In the case of a widget, exiting would theoretically return the user to the widget loop. If it were to do this, what widget should be displayed? Or maybe the user should be dropped at the clock page?

    Even if we decided on a behavior, it wouldn't work on a device until the device firmware had integrated. This would cause headaches as developers would be leaning on System.exit() to do something, but it wouldn't behave that way on all devices. In the end, we decided that changing the behavior of System.exit() was not worth it.


    I think exiting to the clock page would be the sensible solution. The behavior as it's now have to pop all views to bring the user to the first screen of the app and then let the user move forward or backward isn't the most user friendly as the user basically has to exit twice...

  • @Travis

    any chance this gets into attention again? Or at least please provide a final decision that it will stay like it is also in the future.

    Thanks!

    Bye
  • The team discussed this prior to my most recent response...

    In the end, we decided that changing the behavior of System.exit() was not worth it.


    I don't believe that we'll be revisiting.
  • ok, topic closed then, thanks!
  • Former Member
    Former Member over 5 years ago in reply to Travis.ConnectIQ

    Hi Travis,
    We have a bug with a widget (https://apps.garmin.com/en-US/apps/03e01c2d-9eb3-4d8e-99c9-e45e5bd0936f) on the Vivoactive3 and the lack of a proper exit (we can only call System.exit() thru an input handler) :

    Here is the case :

    1) The user launches the widget

    2) he stays on the widget and do nothing

    3) after +- 25 min with the time out the view come back to the clock,  BUT on the native clock (not to a watchface set by the user)

    => This is very annoying. This bug doesn't appear if the user push on the back button (and call the System.exit())

    Our plan was to make a System.exit() happen after 30 sec without the intervention of the user.

    We can't do it...

    Do you have a suggestion ?

    Thanks,

    Olivier

  • In this thread, it's stated that System.exit doesn't work in a widget, and that's by design and won't change.

    If you don't interact with a widget, it should time out in less than 1 minute on the va3 ( just time it at ~40 seconds with a widget of mine with the 7.20 fw)  I'm not sure why you're seeing 25 minutes.