mirror of
https://bitbucket.org/TheBosZ/cordova-plugin-run-in-background
synced 2025-12-13 09:53:22 +00:00
Detect screen status
This commit is contained in:
@@ -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.
|
||||
*
|
||||
|
||||
Reference in New Issue
Block a user