I am using eas developmentClient for development purpose .
"development": {
"developmentClient": true,
"distribution": "internal"
},
I have define a taskmanager where I get latest user current latlng and send notification based on that.
In android its working fine , but in ios device it is not working .
I have define this also in app.json:
infoPlist: {
UIBackgroundModes: [
"location",
"fetch",
"remote-notification",
"processing",
],
}
This is my taskmanager code:
const BACKGROUND_FETCH_TASK = "BG_FETCH_TASK";
TaskManager.defineTask(BACKGROUND_FETCH_TASK, async ({ data, error }) => {
if (error) {
console.log("TaskManager encountered an error:", error);
return;
}
try {
console.log("TaskManager is running >>>>>>>>>>>>>>>>> ");
const currentLocation = await Location.getLastKnownPositionAsync();
//perform my other custom tasks to send noticication
return BackgroundFetch.BackgroundFetchResult.NewData;
} catch (e) {
console.error(e);
}
});
const registerBackgroundFetchAsync = async () => {
await BackgroundFetch.registerTaskAsync(BACKGROUND_FETCH_TASK, {
minimumInterval: BACKGROUND_INTERVAL, // Minimum interval in seconds (e.g., 15 minutes)
stopOnTerminate: false, // Continue background fetch even if the app terminates
startOnBoot: true, // Start background fetch on device boot
});
};
const unregisterBackgroundFetchAsync = async () => {
const isRegistered = await TaskManager.isTaskRegisteredAsync(
BACKGROUND_FETCH_TASK
);
if (isRegistered) {
await BackgroundFetch.unregisterTaskAsync(BACKGROUND_FETCH_TASK);
console.log("Background unregistered");
}
};
Am i missing any other configuration for this taskmanager to work in iphones ?