How to use a Background Service to sincronice internal storage and remote storage

Hello everyone, I have an app developed in Ionic + Angular + Cordova, but I need to have a service that can run when the app is not in use.

My application needs to communicate with a server when the user is not actively using the app to perform downloads or updates. Users often use my app in areas with no network coverage, which is why I need to synchronize my app during times when the user is not actively using it.

The Background Fetch plugin is not suitable for me because it requires writing logic in Java. What I’m looking for is the possibility to achieve this using TypeScript without relying on any other tools. I’m also aware of the existence of the Background-Mode plugin, but even though it can be helpful in certain situations, it is still not a true background service.

My ultimate goal is to establish communication between my app’s internal database and the Firebase database using a background service that runs by the Android system itself when the user is not actively using the app. Is this possible nowadays?

Thank you to anyone who can contribute to this solution.