2 years ago
#47614
shyguy189540
How do I make my Expo EAS app only track a user's background location in certain screens?
I have a RN/EAS app that tracks a user's background location. I only want their background location to be logged in certain screens, but whenever I have the app engaged in any screen, I get the blue, background location tracking notice.
I have my task manager existing in the App.js folder, but I am unsure how I may properly configure it to only run in certain screens. Below is my TaskManager code:
const LOCATION_TASK_NAME = 'background-location-task'
TaskManager.defineTask('firstTask', ({data, error}) => {
if(error){
alert('Something went wrong with background locations')
}
if(data){
alert('Something went right with background locations')
const{locations} = data
console.log(locations, 'locations')
}
})
javascript
react-native
geolocation
expo
location
0 Answers
Your Answer