How to run app in the background

I have a mobile app that uses GroundDB locally ( When users log in to the app and they have an Internet connection, certain collections synchronize between what’s in the local GroundDB database and what’s on the main database on the server side.

I want the app to synchronize automatically when users have an Internet connection, without them having to open the app. Is there a way for the app to run automatically in the background, especially if it can listen for whether or not there is a connection to the server?

I don’t have any experience doing this with a cordova app, but you might start here.

I appreciate the response but I don’t think this fits. If the app launches every time the phone boots I think it will primarily annoy users. I can investigate some sort of system where maybe the app can launch on the device booting, and then shut itself down after its business is done, but I don’t think that’s the right way to do it. It also only covers people who turn their devices off and on often, many go weeks if not longer without turning off their devices, and I still want data to synchronize for them when they get an Internet connection.