How to make background service,when app is closed it should Run ionic

How to make background service,when app is closed it should Run

Do you have no concern for your usersā€™ battery life?

this is the scenario,the user submit the case in offline when i got the internet connection i should forward the submit data from sqllite database to portal.

Yes, I dont concern the battery life

Fine. Do it when the app is active. Perhaps you can subscribe to the Platform.resume event. When the user wants your app to be asleep, it should not be consuming device resources.

1 Like

Is there any plugins available or how to create background serviceā€¦can u share sample code of create background serviceā€¦it will be helpfull

Sorry, but Iā€™m not interested in facilitating what I consider to be something that may reflect badly on Ionic as a framework.

1 Like

This exists: https://ionicframework.com/docs/native/background-mode/
But it will empty the battery and be a bad experience for the users probably.

Where to use this plugin eg:(app.component.ts) and how to create serviceā€¦?

Read the documentation. This is not a ā€œserviceā€, but makes your whole app run continuously.

If we close the app the back ground service automatically killed.