@felicienfrancois/cordova-plugin-stepper
Advanced tools
Comparing version 0.2.4 to 0.2.5
{ | ||
"name": "@felicienfrancois/cordova-plugin-stepper", | ||
"version": "0.2.4", | ||
"version": "0.2.5", | ||
"description": "Lightweight pedometer Cordova/Phonegap plugin for Android using the hardware step sensor, with notifications.", | ||
@@ -5,0 +5,0 @@ "cordova": { |
@@ -53,7 +53,13 @@ # cordova-plugin-stepper | ||
#### disableBatteryOptimizations () [Android only] | ||
#### disableBatteryOptimizations () => Promise [Android only] | ||
Android: request for disabling battery optimizations | ||
IOS: return false and do nothing | ||
```js | ||
stepper.disableBatteryOptimizations(); | ||
stepper.disableBatteryOptimizations().then((result) => { | ||
if(result) console.log("Authorized !"); | ||
else console.log("Denied :-S"); | ||
}).catch((err) => { | ||
console.error(err); | ||
}); | ||
``` | ||
@@ -60,0 +66,0 @@ |
@@ -31,7 +31,7 @@ var exec = require("cordova/exec"); | ||
// IOS & Android - Documented | ||
Stepper.prototype.disableBatteryOptimizations = function () { | ||
Stepper.prototype.disableBatteryOptimizations = function (onSuccess, onError) { | ||
if(!/^android|amazon/i.test(device.platform)) { | ||
return onSuccess(true); | ||
return onSuccess(false); | ||
} | ||
exec(null, null, "Stepper", "disableBatteryOptimizations", []); | ||
exec(onSuccess, onError, "Stepper", "disableBatteryOptimizations", []); | ||
}; | ||
@@ -38,0 +38,0 @@ |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
76757
1406
244