Control

The control API is for manipulation some native control like android back. It has no entry argument.

app.control.onBack()

app.control.onBack is called when the back button is pressed on android devices. So on this event we can manipulate the back in user device.

  • Type: Function

    app.control.onBack = function () {};

  • Example
    Performing an exit android with on back function inside the app.js:
    // on back button event just in android
    app.control.onBack = function () {
        var next = function () {
            if (app.local.exit)
                Android.exit();
            else {
                setTimeout(function () {
                    app.local.exit = false;
                }, 10000);
                app.functions.toast('Press back button again to exit.', {duration: 1000});
                app.local.exit = true;
            }
        };
        next();
    };

    Notice

    Pay attention, app.local.exit should be define at the defint object section and also app.functions.toast must be define inside functions section.