Search code examples
cordovaphonegap-plugins

Cordova: Run events when app in background


Is it possible to run events, if the app is in the background of my iPad? (The app is not closed, but in the background.)

I have an event that runs if my device gets an internet connection. When the app runs normally it works.

If i set up the internet connection and the app is in the background --> nothing.


Solution

  • Apps moving to the background are expected to put themselves into a quiescent state as quickly as possible so that they can be suspended by the system. If your app is in the middle of a task and needs a little extra time to complete that task, it can call the beginBackgroundTaskWithName:expirationHandler:

    Please see documetation here

    but if you want to run in background you have to jailbreak your iphone,iOS: Keep application running in background