Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

468
Views
How do I get background location running in an Expo EAS application on iOS?

I have an EAS stand alone app that was built using Expo SDK 43. I am trying to request permissions to access a user's background location (location when the app is not open but running in the background)

When the app builds the console throws this warning:

TaskManager: Task "background-location-task" has been executed but looks like it is not
 defined. Please make sure that "TaskManager.defineTask" is called during initialization phase.

It also throws this warning as well:

[Unhandled promise rejection: Error: Task 'background-location-task' not found for app ID 'mainApplication'.]

I believe I am setting up background locations properly, but it appears I may not be executing something correctly. Below is my code for how I request background locations.

Note: I have of the background request in a useEffect, and the Task-Manager outside the useEffect inside the file following foreground location requests.

// app.json & Info.Plist:

"ios":{
   ...
     "UIBackgroundModes":[
       "location",
       "fetch"
      ]
 }

//Inside the main file

import * as Location from 'expo-location';
import * as TaskManager from 'expo-task-manager'
import * as BackgroundFetch from 'expo-background-fetch

const LOCATION_TASK_NAME = 'background-location-task';


useEffect(()=>{


async function getBackgroundLocationAsync(){
   let {status} = await Location.requestBackgroundPermissionsAsync()
     if(status!=='granted'){
        setErrorMsg('Permission to access background location was denied')
        return;
       }
       if(status ==='granted'){
         await Location.startLocationUpdatesAsync(LOCATION_TASK_NAME,{
           accuracy: Location.Accuracy.Balanced,
       })
     }

     getBackgroundLocationAsync()

     },
   [],
  )


TaskManager.defineTask(LOCATION_TASK_NAME,({data, error})=>{
  if(error){
 return;
}
if(data){
  const{locations}=data
 }
})
about 4 years ago · Santiago Gelvez
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!