Assigning a callback to the hold button

Hi, thanks for all the help so far, my app is starting to look like something hehe, quick question, is it possible to specify a callback for the hold button on the phone?

thanks

wallnut

Yes, you should be able to use onkey to add a handler to the top level window.

For example, if I add to the end of helloworld.js

window.onkey = function(ev) {
    util.debug("window:" + JSON.stringify(ev));
    return 0;
};

And then run it, I get the following output on the debug log when I press the various keys:

$ ./update.sh log



+Done loading util.js
app.js:Init
                        app.init:appConfigXML:{"$NAME":"appconfig","$CHILDREN":[]}
                        app.init:this.config:{}
auth.js:Constructor
Could not load app specific language keys for fallback lang: en_us
Could not load app specific language keys for lang: en_us
window:{"key":"hold","type":"key"}
window:{"key":"xfer","type":"key"}
window:{"key":"msgs","type":"key"}

If you return true or 1 from the handler, you can prevent the key from being passed to the phone application if you would like.

thx a lot

wallnut