react-native-background-geolocation
react-native-background-geolocation copied to clipboard
Background location not working properly in android.
Your Environment
- Plugin version: 4.14.2
- Platform: iOS or Android : Android
- OS version: Android 13
- Device manufacturer / model: vivo y55
- React Native version (
react-native -v): - Plugin config
const onLocation: Subscription = BackgroundGeolocation.onLocation((userLocation) => {
setLocation(userLocation);
console.log('userLocation', userLocation?.coords?.latitude, new Date()?.toLocaleTimeString())
})
console.log('onLocation===>', onLocation)
BackgroundGeolocation.ready({
desiredAccuracy: BackgroundGeolocation.DESIRED_ACCURACY_HIGH,
distanceFilter: 50,
stopTimeout: 5,
debug: false,
isMoving:true,
logLevel: BackgroundGeolocation['LOG_LEVEL_VERBOSE'],
stopOnTerminate: false,
preventSuspend: true,
startOnBoot: true,
method: 'POST',
batchSync: true,
autoSync: true,
autoSyncThreshold: 20,
headers: { Authorization: '' },
enableTimestampMeta: true,
enabledHeadless:true,
locationAuthorizationRequest: 'Always',
backgroundPermissionRationale: {
title: "Allow to access to this device's location in the background?",
message:
'Required location',
positiveAction: 'Change to "{backgroundPermissionOptionLabel}"',
negativeAction: 'Cancel',
},
notification: {
title: "Background tracking engaged",
text: "My notification text"
},
reset: false,
disableLocationAuthorizationAlert: false,
enableHeadless: true,
foregroundService: true,
showsBackgroundLocationIndicator: true,
disableStopDetection: true,
disableMotionActivityUpdates: true,
}).then((state) => {
console.log("- BackgroundGeolocation is configured and ready: ", state.enabled);
});
Expected Behavior
I want to fetch user location after every 50 m distance travel by user even app is kill or in background state or if app is opened.
Actual Behavior
I am able to get user location after every 50 m distance while app is active mode but in background or kill state location stops working after 3 to 4 minitues. I have also purchased linces for android last night .
model: vivo y55
See https://dontkillmyapp.com
- See api docs Config.stopTimeout
- See wiki "Philosophy of Operation
- see wiki "Debugging"
@christocracy Sorry but i still don't get your point . Can you please explain in detail
What specifically do you not understand, I gave your four things to look at.
@christocracy i have looked at this things but dint't find any solution.
So you modified your device settings according to https://dontkillmyapp.com
Do you understand that Android Manufacturers violate the Android api to prevent Android services from properly functioning (and there's no software solution) and that Vivo is one of the worst offenders?
so i can stop user start again
I don't know what that means. "Stop user start"?
See API docs .getState, State.enabled
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.