diff --git a/src/@ionic-native/plugins/power-optimization/index.ts b/src/@ionic-native/plugins/power-optimization/index.ts new file mode 100644 index 0000000000..c2f9d4cff8 --- /dev/null +++ b/src/@ionic-native/plugins/power-optimization/index.ts @@ -0,0 +1,95 @@ +import { Injectable } from '@angular/core'; +import { Cordova, IonicNativePlugin, Plugin } from '@ionic-native/core'; +/** + * @name Power Optimization + * @description + * Android Custom Roms made sometimes your apps unfunctional due to being killed in the background, notification messages do not appearing or your services being killed by agressive power saving mode. + * The Power Optimization plugin give you android PowerManager methods with cordova. + * + * @usage + * ```typescript + * import { PowerOptimization } from '@ionic-native/power-optimization/ngx'; + * + * constructor(private powerOptimization: PowerOptimization) { } + * + * ... + * + * this.powerOptimization.IsIgnoringBatteryOptimizations() + * .then(onSuccess) + * .catch(onError); + * + * ``` + */ +@Plugin({ + pluginName: 'PowerOptimization', + plugin: 'cordova-plugin-power-optimization', + pluginRef: 'cordova.plugins.PowerOptimization', + repo: 'https://github.com/snt1017/cordova-plugin-power-optimization', + platforms: ['Android'], +}) +@Injectable() +export class PowerOptimization extends IonicNativePlugin { + /** + * Check if the battery optimization is ignoring + * For more info, please check https://github.com/snt1017/cordova-plugin-power-optimization + * @returns {Promise} + */ + @Cordova({ sync: true }) + IsIgnoringBatteryOptimizations(): Promise { + return; + } + /** + * Request permisson to ignore optimizations: + * For more info, please check https://github.com/snt1017/cordova-plugin-power-optimization + * @returns {Promise} + */ + @Cordova({ sync: true }) + RequestOptimizations(): Promise { + return; + } + /** + * Go to battery optimizations configurations menu: + * For more info, please check https://github.com/snt1017/cordova-plugin-power-optimization + * @returns {Promise} + */ + @Cordova({ sync: true }) + RequestOptimizationsMenu(): Promise { + return; + } + /** + * Check if have any data restrictions in background: + * For more info, please check https://github.com/snt1017/cordova-plugin-power-optimization + * @returns {Promise} + */ + @Cordova({ sync: true }) + IsIgnoringDataSaver(): Promise { + return; + } + /** + * Go to data restrictions in background configurations menu: + * For more info, please check https://github.com/snt1017/cordova-plugin-power-optimization + * @returns {Promise} + */ + @Cordova({ sync: true }) + RequestDataSaverMenu(): Promise { + return; + } + /** + * Check if have another battery restriction is present into phone (like huawei, xiaomi, etc): + * For more info, please check https://github.com/snt1017/cordova-plugin-power-optimization + * @returns {Promise} + */ + @Cordova({ sync: true }) + HaveProtectedAppsCheck(): Promise { + return; + } + /** + * Go to configurations menu if another battery restriction is present into phone (like huawei, xiaomi, etc). You can send true into params if you want to force show the menu (is only show the fist time without params): + * For more info, please check https://github.com/snt1017/cordova-plugin-power-optimization + * @returns {Promise} + */ + @Cordova({ sync: true }) + ProtectedAppCheck(): Promise { + return; + } +}