mirror of
https://bitbucket.org/TheBosZ/cordova-plugin-run-in-background
synced 2025-12-13 01:43:24 +00:00
Receive if the background mode is enabled
This commit is contained in:
@@ -41,6 +41,13 @@ channel.onCordovaReady.subscribe(function () {
|
||||
});
|
||||
|
||||
|
||||
/**
|
||||
* @private
|
||||
*
|
||||
* Flag indicated if the mod is enabled.
|
||||
*/
|
||||
exports._isEnabled = true;
|
||||
|
||||
/**
|
||||
* @private
|
||||
*
|
||||
@@ -60,6 +67,7 @@ exports._defaults = {
|
||||
* for the next time.
|
||||
*/
|
||||
exports.enable = function () {
|
||||
this._isEnabled = true;
|
||||
cordova.exec(null, null, 'BackgroundMode', 'enable', []);
|
||||
};
|
||||
|
||||
@@ -68,6 +76,7 @@ exports.enable = function () {
|
||||
* will not stay awake while in background.
|
||||
*/
|
||||
exports.disable = function () {
|
||||
this._isEnabled = false;
|
||||
cordova.exec(null, null, 'BackgroundMode', 'disable', []);
|
||||
};
|
||||
|
||||
@@ -115,6 +124,15 @@ exports.configure = function (options) {
|
||||
}
|
||||
};
|
||||
|
||||
/**
|
||||
* If the mode is enabled or not.
|
||||
*
|
||||
* @return {Boolean}
|
||||
*/
|
||||
exports.isEnabled = function () {
|
||||
return this._isEnabled;
|
||||
};
|
||||
|
||||
/**
|
||||
* Called when the background mode has been activated.
|
||||
*/
|
||||
|
||||
Reference in New Issue
Block a user