Closed youbirox closed 1 month ago
@youbirox I really need your help if you can... I have already raised a issue -> Github issue I have configured everything as per the doc available in the library also installed the demo app which is attached to the library but I am not able to get any events in my app or demo app. Have you faced any issue while integrating the library ? Can you check my code which is there in the issue? if you find any issue in my code then plz reply.
@ashishmangukiya yes , I can check your code .
sure not working on IOS real device ,
version 4.2.3
import moment from 'moment'; import BackgroundFetch from '../helpers/rnbackgroundfetch' import { setTimeStamp } from '../redux-toolkit/reducer'; import { store } from '../redux-toolkit/store'; export const initBGTaskSchedule = async () => { // Step 1: Configure BackgroundFetch as usual. await BackgroundFetch.configure({ minimumFetchInterval: 15 }, async (taskId) => { // <-- Event callback // This is the fetch-event callback. // Use a switch statement to route task-handling. switch (taskId) { case 'com.transistorsoft.customtask': store?.dispatch(setTimeStamp(moment().milliseconds())) break; default: break } // Finish, providing received taskId. BackgroundFetch.finish(taskId); }, async (taskId) => { // <-- Task timeout callback // This task has exceeded its allowed running-time. // You must stop what you're doing and immediately .finish(taskId) BackgroundFetch.finish(taskId); }); }
export const scheduleTask = async () => { // Step 2: Schedule a custom "oneshot" task "com.foo.customtask" to execute 5000ms from now. await BackgroundFetch.scheduleTask({ taskId: "com.transistorsoft.customtask", forceAlarmManager: true, delay: 5000 // <-- milliseconds }); }
but I have a question, is it normal to stop working after one day?
Yes, if you don't periodically open the app, the iOS background-fetch algorithm will halt firing events.
Your Environment
react-native -v
): react-native-cli: 2.0.1/react-native: 0.70.6Expected Behavior
It works well periodically, sometimes every 15 minutes, sometimes 1 hour, sometimes it stops.
but I have a question, is it normal to stop working after one day? , I test on testflight. or will I have to push it to the app store
Actual Behavior
Context
In app.js :
Debug logs