resume

resume

The resume event fires when the native platform pulls the application out from the background.

Quick Example

document.addEventListener("resume", onResume, false);

function onResume() {
    // Handle the resume event
}

iOS Quirks

Any interactive functions called from a pause event handler execute later when the app resumes, as signaled by the resume event. These include alerts, console.log(), and any calls from plugins or the Cordova API, which go through Objective-C.

  • active event

    The iOS-specific active event is available as an alternative to resume, and detects when users disable the Lock button to unlock the device with the app running in the foreground. If the app (and device) is enabled for multi-tasking, this is paired with a subsequent resume event, but only under iOS 5. In effect, all locked apps in iOS 5 that have multi-tasking enabled are pushed to the background. For apps to remain running when locked under iOS 5, disable the app's multi-tasking by setting UIApplicationExitsOnSuspend to YES. To run when locked on iOS 4, this setting does not matter.

  • resume event

    When called from a resume event handler, interactive functions such as alert() need to be wrapped in a setTimeout() call with a timeout value of zero, or else the app hangs. For example:

    document.addEventListener("resume", onResume, false);
    function onResume() {
        setTimeout(function() {
                // TODO: do your thing!
            }, 0);
    }
    

Android Quirks

Refer Android Life Cycle Guide for details on android quirks with the resume event.

doc_cordova
2017-01-31 03:40:37
Comments
Leave a Comment

Please login to continue.