Run function when background mode is active using ionic 4
Better to do it as in example below:
this.backgroundMode.on('activate').subscribe(s => {
console.log('backgroundMode activate');
});
this.backgroundMode.enable();
More information about it you can take from this
Cordova Background Plugin
Background mode is not working in ionic 5
Check your project type in ionic.config.json file.
If the type is "ionic-angular", then install 4.x.x version.
npm i -s @ionic-native/background-mode@4.20.0
If the type is "angular", then install 5.x.x-beta version
npm i -s @ionic-native/background-mode@5.0.0-beta.24
Credit goes to - Diego Desenvolvedor for this link here
How do create background service for Android in Ionic?
Your question is composed of several questions.
Runing after restart
There is an Ionic plugin that can do this. Autostart
Send request when application is closed
You can use the Backgroud mode Ionic plugin.
Display notification
OneSignal can display notifications, sent from your backend, on your smartphone. There is also a Ionic plugin for OneSignal. The plugin will take care of being active even if your app is not and will also always be up, even after restart.
Related Topics
Update Specific Field in Text File in Specific Line
How to Pass a Complete Argument List in Bash While Keeping Mulitword Arguments Together
Measuring Stack Usage for Linux Multi-Threaded App
How to Find Files with Same Size
Why Doesn't Linux Accept() Return Eintr
Environment Variable Used in Shell Script Appear Blank in Log File When Run by Cron
How to Extract Patterns Form a Text Files in Shell Bash
Bash Shell: Cannot Use Variable $ as a Path to Run Tar
How to Add Output "Non_Assigned" When There Is No Match in Grep
How to Make Git-Bash Command Line Start Up with Home Directory
Compute Base64 Encoded Hash from a Given Hash
Replace Text Between Two Lines with Contents of a File Stored in a Variable in Sed
How to Suspend and Resume a Sequence of Commands in Bash
Error Cl_Device_Not_Available When Calling Clcreatecontext (Intel Core2Duo, Intel Ocl Sdk 3.0 Beta)
How to Run Ionic in the Background
Elegant Way to Set Base Address of Elf Image with Linux Binutils