Background location not working after the app is in the background

I have created an app that should always retrieve the geo-position of the user. Even if the app is in the background. I used react Expo’s TaskManager to do this. However, it doesn’t work at all on my emulator. Then I tried the Expo Go app on my android tablet. Here the geoposition is determined as long as the app is in the foreground. However, as soon as this is in the background, it stops tracking the geo position even though I have allowed every permission. I am using SDK 48.

Can someone help me with that? :smiley:

TaskManager:

TaskManager.defineTask(TaskNames.BackgroundLocation, ({ data, error }) => {  
    if (error) {
        console.error(error);
      return;
    }
    if (data) {
        const { locations } = data
        console.log(locations);
    }
});

startLocationUpdatesAsync:

if (this.backgroundStatus == 'granted') {
            await Location.startLocationUpdatesAsync(taskName, {
                accuracy: Location.Accuracy.BestForNavigation,
                timeInterval: 1000,
               // distanceInterval: 1,
               activityType: Location.ActivityType.AutomotiveNavigation,
               showsBackgroundLocationIndicator: true,
               foregroundService: {
                notificationTitle: "Text",
                notificationBody: "Text",
                notificationColor: "#RRGGBB",
              },
            });
        }

Hello, i am having the same issue, did u manage to solve this? =)

Hi yes I did, it is working when you build the app :smiley:
In development it will not work

Great ! thank you man, i figured it out when i built the apk also =D