From 4b31ee309759af000c54ae6ba6c5d23b78cf380e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Sebasti=C3=A1n=20Katzer?= Date: Mon, 30 Jan 2017 09:37:21 +0100 Subject: [PATCH] Fix potential init bug in js interface --- www/background-mode.js | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/www/background-mode.js b/www/background-mode.js index a34d922..993296c 100644 --- a/www/background-mode.js +++ b/www/background-mode.js @@ -339,9 +339,13 @@ exports.mergeWithDefaults = function (options) { */ exports.pluginInitialize = function () { this._isAndroid = device.platform.match(/^android|amazon/i) !== null; - this._isEnabled = this._isEnabled || device.platform == 'browser'; - this._isActive = this._isActive || device.platform == 'browser'; this.setDefaults({}); + + if (device.platform == 'browser' || window.webkit !== undefined) { + this.enable(); + } + + this._isActive = this._isActive || device.platform == 'browser'; }; @@ -354,7 +358,7 @@ exports.pluginInitialize = function () { * * Flag indicates if the mode is enabled. */ -exports._isEnabled = window.webkit !== undefined; +exports._isEnabled = false; /** * @private