npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

cordova-plugin-power-optimization

v0.0.4

Published

*Cordova plugin power save* ========================================================= This plugins give you android PowerManager methods with cordova.

Downloads

493

Readme

Cordova plugin power save

This plugins give you android PowerManager methods with cordova.

To use this plugin, be sure that your app is allowed to use this features in this link: https://developer.android.com/training/monitoring-device-state/doze-standby

Android Custom Roms made sometimes your apps unfunctional due to:

  • Your App is killed when it's not in foreground
  • Notification message do not appear
  • Your services is killed by agressive power saving mode

Please if you have a Samsung, Meizu, Letv test this plugin to help me, thanks!

Current protected apps supported devices:

  • Huawei (TESTED)
  • Xiaomi (TESTED)
  • Samsung (NOT TESTED)
  • Meizu ( NOT TESTED)
  • Letv (NOT TESTED)

Instalation

cordova plugin add cordova-plugin-power-optimization

Usage

Check if the battery optimization is ignoring:

cordova.plugins.PowerOptimization.IsIgnoringBatteryOptimizations().then((result)=> {
  console.log(result);
}, (err) => {
  console.error(err);
});

Request permisson to ignore optimizations:

cordova.plugins.PowerOptimization.RequestOptimizations().then((result) => {
  console.log('ok');
}, (err) => {
  console.error(err);
});

Go to battery optimizations configurations menu:

cordova.plugins.PowerOptimization.RequestOptimizationsMenu().then((result) => {
  console.log('ok');
}, (err) => {
  console.error(err);
});

Check if have any data restrictions in background:

cordova.plugins.PowerOptimization.IsIgnoringDataSaver().then((result) => {
  console.log(result);
}, (err) => {
  console.error(err);
});

Go to data restrictions in background configurations menu:

cordova.plugins.PowerOptimization.RequestDataSaverMenu().then((result) => {
  console.log('ok');
}, (err) => {
  console.error(err);
});

Check if have another battery restriction is present into phone (like huawei, xiaomi, etc):

cordova.plugins.PowerOptimization.HaveProtectedAppsCheck().then((result) => {
  console.log(result);
}, (err) => {
  console.error(err);
});

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):

cordova.plugins.PowerOptimization.ProtectedAppCheck().then((result) => {
  console.log(result);
}, (err) => {
  console.error(err);
});

Notes

Be sure that your AndroidManifest.xml contains this permission

<uses-permission android:name="android.permission.REQUEST_IGNORE_BATTERY_OPTIMIZATIONS" />

Based in this repo:

AppKillerManager

Help liks:

backgroundable-android

Network access in doze mode

REQUEST_IGNORE_BATTERY_OPTIMIZATIONS how to do it right

Android PowerManager