Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Unable to get location at specified interval or distance while re launch the app again #1452

Closed
kmanikandan8122 opened this issue Jul 4, 2024 · 3 comments
Labels

Comments

@kmanikandan8122
Copy link

Your Environment

Plugin version:4.16.5

Platform: :Android

OS version:Android 14

Device manufacturer / model:Vivo

Cordova version (cordova -v):12.0.0 (cordova-lib@12.0.1)

Cordova platform version (cordova platform ls):

Installed platforms:
android 10.1.2
ios 6.3.0
Available platforms:
browser
electron
PASTE_YOUR_CODE_HERE
backgroundgeolocationupdate(){
BackgroundGeolocation.ready({
distanceFilter:0,

  stopOnTerminate: true,
  logLevel: BackgroundGeolocation.LOG_LEVEL_VERBOSE,
  debug: true,
  locationUpdateInterval:30000

}, (state) => {
  console.log("- BackgroundGeolocation is ready: ", state);

  if (!state.enabled) {

    BackgroundGeolocation.start( ()=>{

      console.log("- Start success");

      BackgroundGeolocation.changePace(true);

BackgroundGeolocation.onLocation (location => {
console.log("[Location -manual movement changes] ", location);

console.log("send gps call")
       this.sendgps();
console.log("send gps called")

console.log(location.is_moving)

});
BackgroundGeolocation.onMotionChange(event => {
console.log("[motionchange] ", event);

});

BackgroundGeolocation.onHttp(response => {
console.log("[http] ", response);
});

BackgroundGeolocation.onActivityChange(activityEvent => {
console.log("[activitychange] ", activityEvent);
});

BackgroundGeolocation.onProviderChange(providerEvent => {
console.log("[providerchange] ", providerEvent);
});

const subscription = BackgroundGeolocation.onHeartbeat((event) => {
console.log("[onHeartbeat] ", event);

BackgroundGeolocation.getCurrentPosition({
samples: 1,
persist: true
}).then((location) => {
console.log("[getCurrentPosition] ", location);
});
})
});
}
else
{
console.log('enabled');
}

});

}

Expected Behavior

I need to get background geo location when app running in foreground or background every 30 mins or 1 km distance movement

Actual Behavior

When i call the method backgroundgeolocationupdate() it works properly and i can able to get the location update properly by onlocation() but after closed the app from background again i opened then i called the backgroundgeolocationupdate() method i got error "Uncaught (in promise): Waiting for previous start action to complete" I used stopOnTerminate as true but still i got error

Steps to Reproduce

1.Called the method backgroundgeolocationupdate() first time after login
2.Closed the app from Background
3.Opened the app and called the method backgroundgeolocationupdate() again.
4.Shows error "Uncaught (in promise): Waiting for previous start action to complete" location update also not working

Context

Debug logs

Logs
PASTE_YOUR_LOGS_HERE
@kmanikandan8122
Copy link
Author

When moving from one component to another component onlocation not working

Copy link

github-actions bot commented Aug 5, 2024

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

@github-actions github-actions bot added the stale label Aug 5, 2024
Copy link

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

1 participant