I am currently developing a todo app (android) using ionic framework which can synchronize with the pouchdb when it is connected to the internet, and also user will receive notification in background when new task has been added to the database and sync to the phone.
So if I want the user to receive the notification in background the whole app should be also running in background so that it will detect any new task sync to the phone and generate local notification to notify the user about the incoming new task.
So my question is: is it possible to make my whole cordova/ionic app or whole app.js to be running in background as a background service?
Create a Service (Right click on app folder, new-->Service in Android Studio) inside the folder where MainActivity is present. Give the same package name of MainActivity at top of the new file. Then put the service code and instructions by how to work.
To run your app, all you have to do is enable USB debugging and Developer Mode on your Android device, then run ionic cordova run android --device from the command line. Enabling USB debugging and Developer Mode can vary between devices, but is easy to look up with a Google search.
You can try to use this plugin:
https://github.com/MobileChromeApps/cordova-plugin-background-app
eventually, if you need, in conjunction with:
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With