Detect screen status

This commit is contained in:
Sebastián Katzer
2017-02-06 15:59:57 +01:00
parent 8064b8853f
commit 131df973fb
5 changed files with 133 additions and 55 deletions

View File

@@ -181,6 +181,21 @@ exports.overrideBackButton = function () {
}, false);
};
/**
* If the screen is off.
*
* @param [ Function ] fn Callback function to invoke with boolean arg.
*
* @return [ Void ]
*/
exports.isScreenOff = function (fn) {
if (this._isAndroid) {
cordova.exec(fn, null, 'BackgroundMode', 'dimmed', []);
} else {
fn(undefined);
}
};
/**
* If the mode is enabled or disabled.
*