Expo.Location.startLocationUpdatesAsync doesn't work on android

I’m working with the new expo version (32.0.0) according the oficial documentation we can start to get the location updates with Location.startLocationUpdatesAsync, on iOS I have to setup something additional in my app.json file, I did it, for android I don’t have to do anything additional, but on android doesn’t work wen the app is sent in background mode.

3 Likes

I’m struggling with the same issue. On iOS it’s working fine within the expo client but on Android I don’t get any location updates. I’ve set up my TaskManager outside my App entry Component (App.js) and I’m calling Location.startLocationUpdatesAsync() from another Component. The problem only occurs on Android. Sometimes when testing with some fake GPS data I’m able to get a few location updates when the App is in the background but that only works for about 3-4 minutes and then the App crashes without an error log. It just disappears from the open apps menu.

2 Likes

I just found out that when using Google Maps Navigation simultaneously it seems to trigger the background updates in my App. So I guess the TaskManager and Location.startLocationUpdatesAsync() are working correctly. It seems to be a problem with the Android system. Also I noticed that when my App is in background the icon for GPS usage disappears (when using Google Maps it stays active). There seems to be a problem telling the Android system to keep using GPS.

2 Likes

We are having the exact problem. In iOS its working fine, but in Android, we have to have Google Maps or Waze navigation to trigger background updates of our app.

1 Like

Hey guys, could you tell me something more about your Android devices on which this is happening? Model, Android version, etc.

Hi tsapeta, first thanks a lot for your work!

We have tried on a couple of Android devices. Right now im trying without luck on a One Plus 3T Android Version 8.0.0 . I will check in some other Android deveices and report back.

hi, what do you mean writing “trigger background updates”?

Hi, for example I need to send the location of the device to the server while the app is on the background, in iOS it works as expected, on android it only works either when the app is in the foreground or if the app is on the background but there is another app like google maps or waze in navigation mode. I can upload some videos with this example

1 Like

thanks! i see it. also looks like location icon in status bar appear only when application in foreground or another maps application opened…

1 Like

I’m using a Samsung Galaxy S7 (Android 8.0.0) and I’m experiencing the exact same behaviour as hoppercat

Android 8’s background location limits may be connected to this issue:
https://developer.android.com/about/versions/oreo/background-location-limits

there is explanation about significant location change

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