react-native-background-geolocation icon indicating copy to clipboard operation
react-native-background-geolocation copied to clipboard

Background location not working properly in android.

Open Mukthayar12 opened this issue 2 years ago • 8 comments

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 .

Mukthayar12 avatar Oct 08 '23 10:10 Mukthayar12

model: vivo y55

See https://dontkillmyapp.com

  • See api docs Config.stopTimeout
  • See wiki "Philosophy of Operation
  • see wiki "Debugging"

christocracy avatar Oct 08 '23 10:10 christocracy

@christocracy Sorry but i still don't get your point . Can you please explain in detail

Mukthayar12 avatar Oct 08 '23 11:10 Mukthayar12

What specifically do you not understand, I gave your four things to look at.

christocracy avatar Oct 08 '23 12:10 christocracy

@christocracy i have looked at this things but dint't find any solution.

Mukthayar12 avatar Oct 08 '23 14:10 Mukthayar12

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?

christocracy avatar Oct 08 '23 14:10 christocracy

so i can stop user start again

I don't know what that means. "Stop user start"?

christocracy avatar Oct 08 '23 20:10 christocracy

See API docs .getState, State.enabled

christocracy avatar Oct 08 '23 20:10 christocracy

This issue is stale because it has been open for 30 days with no activity.

github-actions[bot] avatar May 03 '24 01:05 github-actions[bot]

This issue was closed because it has been inactive for 14 days since being marked as stale.

github-actions[bot] avatar May 18 '24 01:05 github-actions[bot]