- First clone the plugin repo.
git clone https://github.com/transistorsoft/capacitor-background-fetch.git
cd capacitor-background-fetch
- Now compile the plugin's typescript source code.
npm install
npm run build
- Now install the
/example
as you would any Capacitor app.
cd example
npm install
ionic build
npx cap sync
- Now run it:
ionic capacitor run android
ionic capacitor run ios
adb shell cmd jobscheduler run -f com.transistorsoft.backgroundfetch.capacitor.demo 999
The /example
folder has a script that can run the command above:
./scripts/simulate-fetch
See the plugin README to learn how to simulate iOS fetch events.
e -l objc -- (void)[[BGTaskScheduler sharedScheduler] _simulateLaunchForTaskWithIdentifier:@"com.transistorsoft.fetch"]