I have been looking for a few days ago a plugin that allows me to execute a service in the background every x time and that I execute a fragment of code (for example a call ajax).
I have found the following plugin for cordova that allows you to create a background service with which you could get what I want, make an ajax call every 20 minutes and do something depending on what the json returns (for example return an local notification).
Do you think I could implement it in Ionic something similar using this plugin?
I’ve tried the example they have mounted on cordova and it seems to work
I’m also looking into using this for running some background operations. I don’t see why it wouldn’t work with Ionic, it is just a Cordova application underneath the hood. Please update this thread with how things work out for you.
I do “npm i cordova-plugin-bgs-core --save” and then i cannot do the import… Y tried import * from ‘cordova-plugin-bgs-core’ and ‘com.red_folder.phonegap.plugin.backgroundservice’. I tried doing: declare var cordova:any; and then cordova.pluginscom.red_folder.phonegap.plugin.backgroundservice.sample.enable(). Not worked for me. These are the installed plugins <plugin name="com.red_folder.phonegap.plugin.backgroundservice" spec="git+https://github.com/Red-Folder/bgs-core.git" />
I’m trying to do a background service when the app is closed to execute an http callback into a Json to check locally if i have changes in that json each hour
By the way i’m trying to use the example who is in the docs.
Because this plugin it’s only for IOs… I used that plugin but in ios mode, but in Android i can’t use that. I understand the other way you explained in the other post, but when i try to do this i get an error: import { myService } from ‘com.red_folder.phonegap.plugin.backgroundservice.sample’; i get an error