Closed krisidmisso closed 1 year ago
react-native -v
const status: number = await BackgroundFetch.configure( { minimumFetchInterval: 15, // <-- minutes (15 is minimum allowed) stopOnTerminate: false, enableHeadless: true, startOnBoot: true, // Android options forceAlarmManager: false, // <-- Set true to bypass JobScheduler. requiredNetworkType: BackgroundFetch.NETWORK_TYPE_NONE, // Default requiresCharging: false, // Default requiresDeviceIdle: false, // Default requiresBatteryNotLow: false, // Default requiresStorageNotLow: false, // Default }, async (taskId: string) => { console.log('[BackgroundFetch] taskId', taskId); // Create an Event record. const event = await Event.create(taskId, false); // Update state. setEvents(prev => [...prev, event]); // Finish. BackgroundFetch.finish(taskId); }, (taskId: string) => { // Oh No! Our task took too long to complete and the OS has signalled // that this task must be finished immediately. console.log('[Fetch] TIMEOUT taskId:', taskId); BackgroundFetch.finish(taskId); }, );
The task should be scheduled and triggered like it does in Android.
When scheduling a task I get an error inside catch(): The operation couldnt be completed. (BGTaskSchedulerErrorDomain error1.)
catch()
The operation couldnt be completed. (BGTaskSchedulerErrorDomain error1.)
Used same Component as in Example app:
const onClickScheduleTask = () => { BackgroundFetch.scheduleTask({ taskId: 'com.transistorsoft.customtask', delay: 5000, forceAlarmManager: true, }) .then(() => { Alert.alert('scheduleTask', 'Scheduled task with delay: 500ms'); }) .catch(error => { Alert.alert('scheduleTask ERROR', error); }); };
Tap scheduleTask
Alert with error message is displayed
I have added the identifiers in XCode:
AppDelegate.m:
BGTaskSchedulerErrorCodeUnavailable
Your Environment
react-native -v
): 0.69.7Expected Behavior
The task should be scheduled and triggered like it does in Android.
Actual Behavior
When scheduling a task I get an error inside
catch()
:The operation couldnt be completed. (BGTaskSchedulerErrorDomain error1.)
Steps to Reproduce
Used same Component as in Example app:
Tap scheduleTask
Alert with error message is displayed
Context
I have added the identifiers in XCode:
AppDelegate.m:
Debug logs