Skip to content

Commit

Permalink
Support for Amazon FireOS
Browse files Browse the repository at this point in the history
  • Loading branch information
katzer committed Jan 23, 2017
1 parent 096d2b2 commit 009854b
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 5 deletions.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -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
Expand Down
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
11 changes: 6 additions & 5 deletions www/background-mode.js
Original file line number Diff line number Diff line change
Expand Up @@ -99,7 +99,7 @@ exports.setDefaults = function (overrides) {
}
}

if (device.platform == 'Android') {
if (this._isAndroid) {
cordova.exec(null, null, 'BackgroundMode', 'configure', [defaults, false]);
}
};
Expand All @@ -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]);
}
};
Expand All @@ -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', []);
}
};
Expand All @@ -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', []);
}
};
Expand All @@ -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', []);
}
};
Expand Down Expand Up @@ -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;
});
});

Expand Down

0 comments on commit 009854b

Please sign in to comment.