Exit an app

Posted on
  • Lame question:
    How do I exit my app and return to the user's watchface without needing to push the menu button?

  • If you call load() without any arguments it will load the default clock.

  • I actually tried that and it did not exit.
    My code is

    Bangle.loadWidgets();
    Bangle.drawWidgets();
    
    console.log('xxx');
    
    load();
     
    

    When starting the app it logs xxx and shows "Loading...".

  • Ah ok, havin load() instead of load(); helps. But the IDE is claiming "missing semicolon" then :)

  • Weird, I have

    var standardMenu = {
      "" : {title : "Test intents",
            back : function() {load();}},
      // ...more code...,
    };
    
    Bangle.loadWidgets();
    E.showMenu(standardMenu);
    

    where I use a semicolon behind load() and that works to take me to the clock when I press the red software back button in the app.

  • I think you have to call it as the payload of a timeout. 20ms delay will do.
    There is another thread about this as it is a question I once asked when I hit the same problem.

  • I think the issue is the difference between:

    var standardMenu = {
      "" : {title : "Test intents",
            back : function() {load();}},
    };
    // and
    var standardMenu = {
      "" : {title : "Test intents",
            back : load,
      // ...more code...,
    };
    

    The functions in menus get called with the menu itself as an argument, so you're effectivaly calling load({...}) and it can't find a file called "{...}" so it doesn't load anything

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

Exit an app

Posted by Avatar for Hank @Hank

Actions