Support for Amazon FireOS

This commit is contained in:
Sebastián Katzer 2017-01-23 10:08:05 +01:00
parent 096d2b2557
commit 009854bb22
3 changed files with 8 additions and 5 deletions

View File

@ -1,6 +1,7 @@
## ChangeLog ## ChangeLog
#### Version 0.7.0 (not yet released) #### Version 0.7.0 (not yet released)
- __Features__ - __Features__
- Support for Amazon FireOS
- Ability to configure icon and color on Android - Ability to configure icon and color on Android
- Allow app to move to foreground on Android - Allow app to move to foreground on Android
- Allow app to move to background on Android - Allow app to move to background on Android

View File

@ -74,6 +74,7 @@ More informations can be found [here][PGB_plugin].
## ChangeLog ## ChangeLog
#### Version 0.7.0 (not yet released) #### Version 0.7.0 (not yet released)
- __Features__ - __Features__
- Support for Amazon FireOS
- Ability to configure icon and color on Android - Ability to configure icon and color on Android
- Allow app to move to foreground on Android - Allow app to move to foreground on Android
- Allow app to move to background on Android - Allow app to move to background on Android

View File

@ -99,7 +99,7 @@ exports.setDefaults = function (overrides) {
} }
} }
if (device.platform == 'Android') { if (this._isAndroid) {
cordova.exec(null, null, 'BackgroundMode', 'configure', [defaults, false]); cordova.exec(null, null, 'BackgroundMode', 'configure', [defaults, false]);
} }
}; };
@ -114,7 +114,7 @@ exports.setDefaults = function (overrides) {
exports.configure = function (options) { exports.configure = function (options) {
var settings = this.mergeWithDefaults(options); var settings = this.mergeWithDefaults(options);
if (device.platform == 'Android') { if (this._isAndroid) {
cordova.exec(null, null, 'BackgroundMode', 'configure', [settings, true]); cordova.exec(null, null, 'BackgroundMode', 'configure', [settings, true]);
} }
}; };
@ -123,7 +123,7 @@ exports.configure = function (options) {
* Enable GPS-tracking in background (Android). * Enable GPS-tracking in background (Android).
*/ */
exports.disableWebViewOptimizations = function () { exports.disableWebViewOptimizations = function () {
if (device.platform == 'Android') { if (this._isAndroid) {
cordova.exec(null, null, 'BackgroundMode', 'disableWebViewOptimizations', []); cordova.exec(null, null, 'BackgroundMode', 'disableWebViewOptimizations', []);
} }
}; };
@ -134,7 +134,7 @@ exports.disableWebViewOptimizations = function () {
* @return [ Void ] * @return [ Void ]
*/ */
exports.moveToBackground = function () { exports.moveToBackground = function () {
if (device.platform == 'Android') { if (this._isAndroid) {
cordova.exec(null, null, 'BackgroundMode', 'background', []); cordova.exec(null, null, 'BackgroundMode', 'background', []);
} }
}; };
@ -145,7 +145,7 @@ exports.moveToBackground = function () {
* @return [ Void ] * @return [ Void ]
*/ */
exports.moveToForeground = function () { exports.moveToForeground = function () {
if (this.isActive() && device.platform == 'Android') { if (this.isActive() && this._isAndroid) {
cordova.exec(null, null, 'BackgroundMode', 'foreground', []); cordova.exec(null, null, 'BackgroundMode', 'foreground', []);
} }
}; };
@ -348,6 +348,7 @@ exports._defaults = {
channel.onCordovaReady.subscribe(function () { channel.onCordovaReady.subscribe(function () {
channel.onCordovaInfoReady.subscribe(function () { channel.onCordovaInfoReady.subscribe(function () {
exports.setDefaults({}); exports.setDefaults({});
exports._isAndroid = device.platform.match(/^android|amazon/i) !== null;
}); });
}); });