Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Background-mode plugin causes high CPU usage #512

Open
n1705771 opened this issue Jun 17, 2020 · 0 comments
Open

Background-mode plugin causes high CPU usage #512

n1705771 opened this issue Jun 17, 2020 · 0 comments

Comments

@n1705771
Copy link

n1705771 commented Jun 17, 2020

I check the CPU usage and find the application consumes more CPU usage when application running in background mode.
I am not sure if the option setting can improve CPU usage issue, could you please help?
This is my code for using background mode.

backgroundSetting() {
    if (this.globalvar.platform.is('android')){
      const options = {
        id: -1,
        title: 'Test',
        text: 'Running in Background Mode',
        hidden: false,
        silent: false,
        sticky: true,
        resume: true,
        foreground: true,
      };

      cordova.plugins.backgroundMode.setDefaults(options);
      cordova.plugins.backgroundMode.enable();
      cordova.plugins.backgroundMode.on('activate', () => {
        cordova.plugins.backgroundMode.disableWebViewOptimizations();
        console.log('background mode activate !!!');
      });

      cordova.plugins.backgroundMode.on('deactivate', () => {
        console.log("background deactivate xxxx ");
      });

    } else {
      cordova.plugins.backgroundMode.enable();
    }
  }
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant