Expo TaskManager creating a non Location Task

Viewed 37

Is it possible to create a Task that has nothing to do with Location and execute it in the background? I have something like:

import * as TaskManager from 'expo-task-manager';
TaskManager.defineTask("background-computation", ({ data, error }) => {
console.log("Task called")
if (error) {
console.log("error: ", error.message);
return;
}
if (data) {
console.log(data)
return "success";
}
});

I don't find any example on how to execute this Task now.

For the location they use this in the documentation:

await Location.startLocationUpdatesAsync(LOCATION_TASK_NAME, { accuracy: Location.Accuracy.Balanced, });

This is the documentation

Any help appreciated!

0 Answers
Related