How to pass TaskManager BACKGROUND_LOCATION_FETCH data from app.js to other react components ?

Please provide the following:

  1. SDK Version: 49.0.5
  2. Platforms(Android/iOS/web/all): Android
  3. Add the appropriate “Tag” based on what Expo library you have a question on.

I am trying to build a transportation mobile app. I have a component map.js in which i am calling startLocationUpdatesAsync with BACKGROUND_LOCATION_FETCH task which is defined in app.js. I need the data that TaskManager has returned (location coordinates) inside my map.js. I am not able to use useState as I have to define task out of App function and also unable to use redux hooks to dispatch data. How can i send this data from app.js to map.js ? Thank you.

(I have tried defining TaskManager in my map.js and it most of the times returns this error TaskManager: Task "BACKGROUND_LOCATION_FETCH" has been executed but looks like it is not defined. Please make sure that "TaskManager.defineTask" is called during initialization phase.)

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.