2

I want to do the following:

Create a Phonegap service that runs in the background even if the android app is not open.

1 Answer 1

3

You may use the plugin: https://github.com/katzer/cordova-plugin-background-mode

To prevent the app from being paused while in background, the backroundMode.enable interface has to be calle, like this:

cordova.plugins.backgroundMode.enable();

So, the backgroundMode.isActive interface can be used to get the information if the background mode is active:

Then, the backgroundMode.onactivate interface can be used to get notified when the background mode has been activated.

cordova.plugins.backgroundMode.isEnabled();

cordova.plugins.backgroundMode.onactivate = function() {};

See the link to more detailed information, I have helped.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.