[Android Only] Added more functions

Notably 'isIgnoringBatteryOptimizations' and 'addAppToBatteryWhitelist'
pull/1/head
Max Bassett 8 years ago committed by GitHub
parent e65ce7b36c
commit b4f2f22e7b

@ -65,9 +65,30 @@ PowerManagement.prototype.dim = function(successCallback,failureCallback) {
* @param successCallback function to be called when the device's idle state returns successfully
* @param errorCallback function to be called when there was a problem with checking the device's idle state
*/
PowerManagement.prototype.isDeviceIdleMode = function(successCallback,failureCallback) {
cordova.exec(successCallback, failureCallback, 'PowerManagement', 'isDeviceIdleMode', []);
}
/**
* Checks if the app has been added to the battery optimization whitelist (i.e. ignores battery optimization). Android Only.
* *** Requires minimum API level 23 ***
*
* @param successCallback function to be called when the check of the battery optimization whitelist returns successfully
* @param errorCallback function to be called when there was a problem with the check of the battery optimization whitelist
*/
PowerManagement.prototype.isIgnoringBatteryOptimizations = function (successCallback,failureCallback) {
cordova.exec(successCallback, failureCallback, 'PowerManagement', 'isIgnoringBatteryOptimizations', []);
};
/**
* Opens a dialog that allows the use to add the app to the battery optimization whitelist. Android Only.
* *** Requires minimum API level 23 ***
*
* @param successCallback function to be called when adding the app to the battery optimization whitelist is successful
* @param errorCallback function to be called when there was a problem with adding the app to the battery optimization whitelist
*/
PowerManagement.prototype.addAppToBatteryWhitelist = function (successCallback,failureCallback) {
cordova.exec(successCallback, failureCallback, 'PowerManagement', 'addAppToBatteryWhitelist', []);
};
module.exports = new PowerManagement();

Loading…
Cancel
Save