How should Apps return to the system

I've read through the docs a few times, and it isn't clear to me how an application is supposed to exit. Assume for a second that the application in question does not use the lap/back button, and this button is pressed. Should the application call Ui.popView(...) to pop the last view and exit, System.exit(...) to just exit outright, or something else?

Travis
  • Former Member
    Former Member over 10 years ago
    Popping your app's last view will exit the app. If your app does not process the back key and return true from the input delegate, the device should pop one view. If it is the last view, the app will exit.

    Widgets should not pop the base view.
  • If your app does not process the back key and return true from the input delegate, the device should pop one view.

    I'm hoping you've got a bit flipped... An input delegate is supposed to return true to indicate that it processed the input. It seems that the device should only pop a view if my delegate returns false to a Ui.KEY_ESC key event.
  • Former Member
    Former Member over 10 years ago
    I don't think I flipped anything, but it may not have been worded very well. I think we said the same thing.

    If you do not provide an input delegate, or if you do, but it does not return true when it receives a Ui.KEY_ESC, the default behavior will pop a view.
  • Popping your app's last view will exit the app. If your app does not process the back key and return true from the input delegate, the device should pop one view. If it is the last view, the app will exit.

    Widgets should not pop the base view.

    If you cannot pop a widget base view (this works in the simulator but not on a watch), is there a way to programatically exit a widget? In certain circumstances I want to be able to exit from a pushed view and can ripple back to the base view by popping, but then get stuck since you cannot pop this.
  • Former Member
    Former Member over 10 years ago
    Widgets are only allowed to exit via the native device inputs at this time. When a Widget is at its base view, the user can exit the widget by moving to the next widget, or pressing the back key.
  • Ok, I feel that this is a bit of a limitation since I can imagine a situation where you want to cause a widget to exit from another view without requiring the user to quit manually after being sent back to the base view.

    I feared this would be the case, so re-architected my base view to do all operations which might lead to a user doing something where they would want to exit directly to avoid this.

    Thanks for the confirmation.