From 009854bb22b352370e76b699a8325b8fee0286b5 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Sebasti=C3=A1n=20Katzer?= Date: Mon, 23 Jan 2017 10:08:05 +0100 Subject: [PATCH] Support for Amazon FireOS --- CHANGELOG.md | 1 + README.md | 1 + www/background-mode.js | 11 ++++++----- 3 files changed, 8 insertions(+), 5 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 8999b4a..a66ef3a 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,6 +1,7 @@ ## ChangeLog #### Version 0.7.0 (not yet released) - __Features__ + - Support for Amazon FireOS - Ability to configure icon and color on Android - Allow app to move to foreground on Android - Allow app to move to background on Android diff --git a/README.md b/README.md index d288b0f..42c9dd4 100644 --- a/README.md +++ b/README.md @@ -74,6 +74,7 @@ More informations can be found [here][PGB_plugin]. ## ChangeLog #### Version 0.7.0 (not yet released) - __Features__ + - Support for Amazon FireOS - Ability to configure icon and color on Android - Allow app to move to foreground on Android - Allow app to move to background on Android diff --git a/www/background-mode.js b/www/background-mode.js index 89e426c..483b07c 100644 --- a/www/background-mode.js +++ b/www/background-mode.js @@ -99,7 +99,7 @@ exports.setDefaults = function (overrides) { } } - if (device.platform == 'Android') { + if (this._isAndroid) { cordova.exec(null, null, 'BackgroundMode', 'configure', [defaults, false]); } }; @@ -114,7 +114,7 @@ exports.setDefaults = function (overrides) { exports.configure = function (options) { var settings = this.mergeWithDefaults(options); - if (device.platform == 'Android') { + if (this._isAndroid) { cordova.exec(null, null, 'BackgroundMode', 'configure', [settings, true]); } }; @@ -123,7 +123,7 @@ exports.configure = function (options) { * Enable GPS-tracking in background (Android). */ exports.disableWebViewOptimizations = function () { - if (device.platform == 'Android') { + if (this._isAndroid) { cordova.exec(null, null, 'BackgroundMode', 'disableWebViewOptimizations', []); } }; @@ -134,7 +134,7 @@ exports.disableWebViewOptimizations = function () { * @return [ Void ] */ exports.moveToBackground = function () { - if (device.platform == 'Android') { + if (this._isAndroid) { cordova.exec(null, null, 'BackgroundMode', 'background', []); } }; @@ -145,7 +145,7 @@ exports.moveToBackground = function () { * @return [ Void ] */ exports.moveToForeground = function () { - if (this.isActive() && device.platform == 'Android') { + if (this.isActive() && this._isAndroid) { cordova.exec(null, null, 'BackgroundMode', 'foreground', []); } }; @@ -348,6 +348,7 @@ exports._defaults = { channel.onCordovaReady.subscribe(function () { channel.onCordovaInfoReady.subscribe(function () { exports.setDefaults({}); + exports._isAndroid = device.platform.match(/^android|amazon/i) !== null; }); });