So far I have not been able to see that BackgroundFetch
runs. As part of the task I am logging to my server when the task is registered and when the task is run. I can see that the task gets registered but I never see any logs to show the task has run.
app.json
"ios": {
"infoPlist": {
"UIBackgroundModes": [
"location",
"fetch"
]
definition of task called from App.json
defineHealthTask = () => {
TaskManager.defineTask(taskName, async () => {
try {
await UserRemoteLogService.logWithTaskType("STEPS_TASK_RUNNING");
return BackgroundFetch.Result.NewData;
} catch (error) {
return BackgroundFetch.Result.Failed;
}
});
};
registering task
await UserRemoteLogService.logWithTaskType("STEPS_TASK_REGISTRATION_REQUESTED");
const pedometerAvailable = await Pedometer.isAvailableAsync();
const backGroundFetchStatus = await BackgroundFetch.getStatusAsync();
if (pedometerAvailable && BackgroundFetch.Status.Available === backGroundFetchStatus) {
await BackgroundFetch.registerTaskAsync(taskName, {
userBusinessId: user.businessId
});
UserRemoteLogService.logWithTaskType("STEPS_TASK_REGISTERED");
}
in my backend I see that the task is registered but I never see a log to show that it has run, the logging service works in a defined task for location so i see no reason why I should not be seeing the log it this task was running.
So the question is have people seen this background task running? Have i missed something obvious which i should have set?