Location is not recording while in sleep mode
Rajam0310 opened this issue · 9 comments
Your Environment
- Plugin version:4.1.0
- Platform: Android
- OS version: Android 11 and above
- Device manufacturer / model: All
- Cordova version (
cordova -v
): 10.1.2 - Cordova platform version (
cordova platform ls
):
Installed platforms:
android 10.1.2
ios 6.2.0
Available platforms:
browser
electron - Plugin config provided to
#ready
:
await BackgroundGeolocation.ready({
distanceFilter: 0,
debug: false,
fastestLocationUpdateInterval: 30000,
foregroundService: true,
locationUpdateInterval: 30000,
locationAuthorizationRequest: 'Always',
notification: {
title: "AllTrans GPS Tracking",
text: "Live Location Sharing",
},
backgroundPermissionRationale: {
title: "Allow AllTrans to access to this device's location in the background?",
message: "In order to track your activity in the background, please enable Allow all the time location permission",
}
}).then((state) => {
BackgroundGeolocation.start();
});
BackgroundGeolocation.getCurrentPosition({
timeout: 30
}).then((location) => {
console.log(location, 'location')
this.latitude = location.coords.latitude
this.longitude = location.coords.longitude
if (this.gpsTime != location.timestamp) {
if (this.platform.is('android') || this.platform.is('ios')) {
this.sendgps();
// console.log('sendgps')
}
} else {
if(location.coords.latitude && location.coords.longitude)
this.sendgps();
}
this.gpsTime = location.timestamp;
})
}
Expected Behavior
Track the GPS Location when mobile is sleep mode even in stationery position
Actual Behavior
Its Not tracking after 15 seconds in sleep mode
Steps to Reproduce
Context
App which is running in foreground or background or sleep we have to track the live location even in stationery position.
Debug logs
Logs
PASTE_YOUR_LOGS_HERE
even in stationery position.
Read the wiki “Philosophy of Operation”. This plugin does not record location while the device is in the stationary state (that would be pointless).
if you want periodic location updates, implement background-fetch (already imported as a dependency) and call .getCurrentPosition in your fetch callback. See its readme.
We have to track the realtime location of user even they are in stationary position and mobile app running in background or fore ground or in sleep ,so we have issue in sleep.Our query is getCurrentPosition will satisfy all the requirement?
Have you read the API docs for .getCurrentPosition? Why don’t you experiment and see?
Already tried. Not working in android 11 and above, actually its stop tracking after 15 seconds while sleep mode
Within a background-fetch handler?
if you want periodic location updates, implement background-fetch (already imported as a dependency) and call .getCurrentPosition in your fetch callback. See its readme.
okay, thanks, will look into it and get back to you.
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.