Closed ororsatti closed 8 months ago
@christocracy
You didn’t post any code. How can I answer if you don’t show how you’re configuring / using the plug-in??
You didn’t post any code. How can I answer if you don’t show how you’re configuring / using the plug-in??
Add relevant code to the question. Sorry
Also @christocracy simulated events works. tested on the simulator.
If I wait the 15 minutes I dont see any events firing
If simulated events work, that’s all you need to know.
everything else is up to the OS. Test on a real device and see https://dontkillmyapp.com
If simulated events work, that’s all you need to know.
everything else is up to the OS. Test on a real device and see https://dontkillmyapp.com
Thanks. but headless events should run periodically too if everything goes smoothly? Just making sure because that wasnt clear on the docs
Any news regarding this issue ?
Any news regarding this issue ?
Any thing you need to know?
I tried configuring a task with these params
{ forceAlarmManager: false, periodic: true, enableHeadless:true, stopOnTerminate: false, startOnBoot: true,}
I can fire the event with the adb command just fine when the app is open or running in the background , however , if I close the app and try to fire the task using adb , I would get No task registered for key BackgroundFetch even though I'm sure stopOnTerminate is set to false in android ! Any help is much appreciated
See api docs BackgroundFetchConfig.enableHeadless
I'm trying to create periodic task that runs every X minutes even if the app is closed or the user reboots the device ( X > 15mins). From my understanding of the docs , when I add a headless task , it would run once the app is terminated but I can't seem to schedule it to run every X minutes. I can't also use a setInterval inside the headless task because it will cause Timeout. Thanks !
See API docs enableHeadless
to learn how to .registerHeadlessTask(yourHeadlessFunction);
BackgroundFetch.configure({
minimumFetchInterval: 15,
enabledHeadless: true,
stopOnTerminate: false,
startOnBoot: true
}, async (taskId) => {
console.log('[BackgroundFetch] taskId', taskId);
// perform work here.
BackgroundFetch.finish(taskId);
}, async (taskId) => {
console.log('[BackgroundFech] TIMEOUT: ', taskId);
BackgroundFetch.finish(taskId);
});
I have followed the example to add a headlessTask to index.js but how do I make sure that the headlessTask is periodic ? Because from the docs , periodic is only valid only for BackgroundFetch.scheduleTask . Thanks for your help
BackgroundFetch.configure(youConfig)
AUTOMATICALLY initiates a periodic task.
You do NOT need to execute .scheduleTask
.
Okay perfect ! Thanks for your help
Your Environment
react-native -v
): 0.71.6Expected Behavior
Headless task would trigger every [15 minutes]
Actual Behavior
Not sure. I can only force one event.
Steps to Reproduce
Nothing to reproduce I'm just asking a question that is not clear in the docs.
index.js:
Workers:
Context
Run a headless task every 15 minutes. From the docs it can be inferred that a headless task will run every 15 minutes ( or how many is the interval)
Debug logs
Just a question no logs here