react-native-background-fetch: stopOnTerminate, startOnBoot not working .
static async init() {
BackgroundFetch.configure({
minimumFetchInterval: 15, // <-- minutes (15 is minimum allowed)
stopOnTerminate: false, // <-- Android-only,
startOnBoot: true, // <-- Android-only
enableHeadless: true // use for background job react native (Headless) functionality (android)
},
async () => {
await this.service();
BackgroundFetch.finish(BackgroundFetch.FETCH_RESULT_NEW_DATA);
},
this.error
);
}
static async service() {
await LogsUtils.add(LOG_TYPE.INFO, ' backgroundJob call');
}
Your Environment
- Plugin version: 2.0.4
- Platform: Android
- OS version: Oreo
- Device manufacturer / model: Pixel 2xl
- React Native version (0.55.4):
- Plugin config
Expected Behavior
service() should trieger every 15 min .
Actual Behavior
worning : Unable to symbolicate stack trace network request failed; stopOnTerminate, startOnBoot not working
Steps to Reproduce
- in ComponentDidMount call init();
Context
real device
About this issue
- Original URL
- State: closed
- Created 6 years ago
- Reactions: 1
- Comments: 18 (8 by maintainers)
When you enableHeadless: true, the plugin will emit Headless events.
As documented, you receive those events by “registering a headless task.”.
Headless events will begin firing after you terminate (ie decapitate) your app.
It’s unclear on this package’s readme. Do you need to both enableHeadless: true and also do all the java updates stated on the headless wiki? Do you also need to manually registerHeadlessTask? Or is enableHeadless: true enough?
@christocracy I’m having the same doubts about headless tasks.
Would you please elaborate what’s the difference between setting
enableHeadless: true
versus running the headless task directly withBackgroundFetch.registerHeadlessTask(MyHeadlessTask);
?Are both required? The docs/example is a bit misleading with this.