mirror of
https://bitbucket.org/TheBosZ/cordova-plugin-run-in-background
synced 2025-12-15 10:53:22 +00:00
Merged in Menardi/cordova-plugin-run-in-background/android_optimization (pull request #2)
Add more Android battery optimisation functions - Go to Battery Optimization settings screen - Add function to check if battery optimization is enabled or not
This commit is contained in:
@@ -177,6 +177,38 @@ exports.disableBatteryOptimizations = function()
|
||||
}
|
||||
};
|
||||
|
||||
/**
|
||||
* Opens the system settings screen for battery optimization, allowing the user to
|
||||
* manually change the optimization settings.
|
||||
*
|
||||
* @return [ Void ]
|
||||
*/
|
||||
exports.openBatteryOptimizationsSettings = function()
|
||||
{
|
||||
if (this._isAndroid)
|
||||
{
|
||||
cordova.exec(null, null, 'BackgroundModeExt', 'batterysettings', []);
|
||||
}
|
||||
};
|
||||
|
||||
/**
|
||||
* Opens the system settings screen for battery optimization, allowing the user to
|
||||
* manually change the optimization settings.
|
||||
*
|
||||
* @return [ Void ]
|
||||
*/
|
||||
exports.isIgnoringBatteryOptimizations = function(callback)
|
||||
{
|
||||
if (this._isAndroid)
|
||||
{
|
||||
cordova.exec(callback, null, 'BackgroundModeExt', 'optimizationstatus', []);
|
||||
}
|
||||
else
|
||||
{
|
||||
callback(true);
|
||||
}
|
||||
};
|
||||
|
||||
/**
|
||||
* Opens the system settings dialog where the user can tweak or turn off any
|
||||
* custom app start settings added by the manufacturer if available.
|
||||
|
||||
Reference in New Issue
Block a user