react-native-background-geolocation
react-native-background-geolocation copied to clipboard
Background geolocation not sending location when device has not been used for a while
Background geolocation not sending location when device has not been used for a while
Background geolocation does not send the location after the device has not been used for a while (changing location and not interacting with the device).
Your Environment
- Plugin version: 4.13.3
- Platform: Android
- OS version: 11
- Device manufacturer / model: Realme C25Y
- React Native version (
react-native -v): 0.71.8
Plugin Config
useEffect(() => {
// Subscribe to events.
const onLocation = BackgroundGeolocation.onLocation(async (location) => {
await axios.post(
`${URL}/api/v1/post-location/${user._id}`,
{ location },
{
headers: {
Authorization: user.accessToken,
},
}
);
});
BackgroundGeolocation.ready({
desiredAccuracy: BackgroundGeolocation.DESIRED_ACCURACY_HIGH,
distanceFilter: 20,
backgroundPermissionRationale: {
title: "Permite a Palmira acceder a la ubicación en segundo plano?",
message:
"Palmira necesita la ubicación para que la persona cuidadora pueda ver donde se encuentra, si no acepta deberá ir a la configuración de la aplicación en su sitema Android",
positiveAction: "Cambiar a permitir siempre",
negativeAction: "Cancelar",
},
stopTimeout: 5,
debug: false,
logLevel: BackgroundGeolocation.LOG_LEVEL_VERBOSE,
stopOnTerminate: false,
startOnBoot: true,
url: `${URL}/api/v1/post-location/${user._id}`,
batchSync: false,
autoSync: true,
headers: {
"X-FOO": "bar",
},
params: {
auth_token: "",
userId: user._id,
},
}).then((state) => {
setEnabled(state.enabled);
console.log(
"- BackgroundGeolocation is configured and ready: ",
state.enabled
);
});
return () => {
onLocation.remove();
};
}, []);
useEffect(() => {
if (enabled) {
BackgroundGeolocation.start();
} else {
BackgroundGeolocation.stop();
}
}, [enabled]);
Expected Behavior
Server getting location when location changes
Actual Behavior
Server not always getting location when location changes
Steps to Reproduce
Context
Debug logs
Logs
PASTE_YOUR_LOGS_HERE
Plugin version: Latest
Meaningless
has not been used for a while
Define “a while”.
See https://dontkillmyapp.com
How do you know the plug-in is not working? Maybe you simply have a problem with your own http requests.
see wiki “Debugging” and learn to observe logs from the plug-in log database. Also see api docs “Logger”
Thanks for the response.
plugin version: 4.13.3 A while is about one hour in my case.
I have an alert on my android that says that the service has been startedand the time since the service started working. That is why I think that geolocation is not trigering. Is the config ok?
plugin version: 4.13.3
edit your post.
Go fetch your logs.
This issue is stale because it has been open for 30 days with no activity.
This issue was closed because it has been inactive for 14 days since being marked as stale.