startLocationUpdatesAsync not working on ios device via ExpoClient

Hi

I have my App working well in ios simulator. But when I publish it to my ios device, anf try to run it via the ExpoClient App, the await startLocationUpdatesAsync call is not returning, and background tracking is not started.

Is that how it should be? Does that mean that I can’t actually test background tracking well on a device, before publishing it on Google Play og AppStore?

Best regards, Thomas

Hey @tknuts,

You should be able to test on the Client as well. Can you let me know what SDK version you are running? Also, can you double check and make sure the appropriate permissions are granted for the device?

Cheers,
Adam

Hi

I’m on SDK Version 33. All permission on device should be ok. I tried on different iPhones with the same result, it never returns to the code from the call.

The Location permission for the Expo Client on the Phones are “while in use”.

When starting tracking, I ask for:

await Permissions.askAsync(Permissions.LOCATION)

Also in the app.json i added this:

“ios”: {

“supportsTablet”: false,

“infoPlist”: {

“NSLocationWhenInUseUsageDescription”: “For at kunne tracke din rotur, skal vi gerne have adgang til at se din lokation”,

“UIBackgroundModes”: [

“location”,

“fetch”

]

}

}

Here are the options passed to startLocationAsync

const TrackingOptions = {

accuracy: Location.Accuracy.BestForNavigation,

distanceInterval: 10

}

Also tried with timeInterval and some of the other options. Works like it should on the Simulator.

Any ideas?

Regards, Thomas

Hi Adam

Found this in the Background Location doc:

Permissions.LOCATION permission must be granted. On iOS it must be granted with Always option.

But the ExpoClient only has the WhileInUse permission, “Always” is not available.

This states that Background location in only available in standalone apps:

Hi Thomas,

If you’re using Expo SDK 33 and wanting to use background location with iOS when running on Expo Client then you will need to build a custom Expo Client. See info here - https://blog.expo.io/expo-sdk-v33-0-0-is-now-available-52d1c99dfe4c. It doesn’t take long to build the client and provides extra diagnostics functionality.

kind regards
Nick

Thanks Nick…

Building a custom Expo Client solved my problem…

Kind regards, Thomas

Sorry for unrelated question. If i want to update location every 5 seconds without location distance changes. Can i omit distanceInterval param or set it to 0. I’ve tried but it did not work. Could you implement another way to get it?

I have same problem . how you solved that problem?