Quitting (ending) an App?

Posted on
  • Hi Folks

    Total newbie - first time here so please forgive me if the answer should be self evident, but search as I may I have not found the answer to this (for me) fundamental question.

    How do I exit / quit an App?

    I built my first, very basic app, and can start it from the launcher but how do I handle exiting / quitting the App and returning either to the App launcher or perhaps the default clock?

    Appreciate being pointed in the right direction.

    Cheers...

  • Sun 2021.10.17

    Did the long press not return to the default app?

    https://www.espruino.com/Bangle.js+Getti­ng+Started

    As Espruino is an interpreter each line of your code is read separately, then executed before moving on to the next line of code. If not inside a loop, once there are no more instructions to interpret and execute, that code block at that point is effectively ended.

    The code could look out for a button press or screen tap and respond accordingly, such as returning to the default clock or to the app launcher.

    Timers and set watches could be used looking for events.

    https://www.espruino.com/Bangle.js+Devel­opment
    https://www.espruino.com/Bangle.js#tutor­ials

  • Hi Robin

    Again, I appreciate the rapid reply!

    You got me - I'm sorry. I missed the long press exiting an app and returning to the default clock. (Egg on face moment...)

    I did do a setWatch() and listen for a button press and once detected I called load() and the current clock - that worked I just wasn't sure this was the correct way to do it - and moreover it assumes that the user has the same clock installed that I have. Which is a bad assumption.

    How would I call the default clock if I wanted to listen for a specific button press?

    Cheers

  • Example at:

    https://www.espruino.com/Bangle.js+Clock­

    Heading: BTN2 to start the launcher

  • I think calling load() will do it.
    That returns you to the launcher.

  • As @HughB says, just call load() to return to the default clock :)

  • @Gordon and @HughB - really appreciate it. Sorry if I missed it somewhere in the docs.

    Cheers

  • Post a reply
    • Bold
    • Italics
    • Link
    • Image
    • List
    • Quote
    • code
    • Preview
About

Quitting (ending) an App?

Posted by Avatar for user135414 @user135414

Actions