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 not working in Windows 10 apps #289

Open
AnishGj opened this issue Jun 8, 2017 · 3 comments
Open

Background mode plugin not working in Windows 10 apps #289

AnishGj opened this issue Jun 8, 2017 · 3 comments

Comments

@AnishGj
Copy link

AnishGj commented Jun 8, 2017

We are developing a Cordova windows UWP app and we want some method (this method will just hit our service and fetches some data and stores back in SQLite) which needs to run for every 5 minutes. This every 5 minutes tasks needs to be run even if the user minimizes the app.

  When we have developed the same app in ios, we have used this back ground mode plugin. After calling the backgroundmode.enable() method, that method used to run even if the app goes back ground or app has been minimized.

Below code block used.
cordova.plugins.backgroundMode.enable(); // for enabling back ground mode.
setInterval(function () { GetDataFromServer(); }, 30000) // repeating for every 30 seconds.

But when we develop the same app in Cordova for windows 10, the same code is not working if app is minimized. 

Needs to know if this plugin supports back ground mode for Windows apps. Please let us know if there are any other ways to make some block of code to run in minimize mode as well with Cordova windows app.

@nowrap
Copy link

nowrap commented Dec 18, 2017

Any news on this issue?
I am facing the same issue with an Ionic app playing music.

Added this plugin and activated the backgroundMediaPlayback via Visual Studio (as mentioned in #222)

this.platform.ready().then(() => {
  // Okay, so the platform is ready and our plugins are available.
  // Here you can do any higher level native things you might need.

  this.statusBar.styleDefault();
  this.splashScreen.hide();

  // background mode
  console.log("app::backgroundMode", "enabling");
  this.backgroundMode.enable();
  console.log("app::backgroundMode:isEnabled", this.backgroundMode.isEnabled());
  console.log("app::backgroundMode:isActive", this.backgroundMode.isActive());
});

The output is:

app::backgroundMode enabling
app::backgroundMode:isEnabled false
app::backgroundMode:isActive false

Miminizing the app pauses the app and is stopping the music playback.
Switching to other windows doesn't.

@hammadaries
Copy link

I am also facing the same issue. Any updates regarding this issue please?

@nowrap
Copy link

nowrap commented Jan 12, 2019

YoSarins fork https://github.com/YoSarin/cordova-plugin-background-mode/tree/windows_background_execution plus this music controller worked for me: https://github.com/homerours/cordova-music-controls-plugin

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

3 participants