आयनिक के लिए पृष्ठभूमि भौगोलिक स्थान प्लगइन अद्यतन नहीं हो रहा है। मैं चाहता हूं कि कार्यक्षमता प्रत्येक 30 सेकंड उपलब्ध होने पर एक लेट एलएनजी मूल्य के लिए प्लगइन पूछें। मुद्दा यह है कि यह केवल मुझे शुरुआत में मूल्य दे रहा है और फिर पृष्ठभूमि बंद हो जाती है। अग्रभूमि ठीक है, यह वास्तव में पृष्ठभूमि है। असल में मैं पृष्ठभूमि में पहले प्रारंभिक भेजने के बाद अनुरोध भेजने में सक्षम नहीं हूं।पृष्ठभूमि भौगोलिक स्थान ionic 3 अद्यतन नहीं
gps.ts
startTracking() {
console.log('started tracking')
const config: BackgroundGeolocationConfig = {
desiredAccuracy: 10,
stationaryRadius: 20,
distanceFilter: 30,
debug: false, // enable this hear sounds for background-geolocation life-cycle.
stopOnTerminate: false
};
this.backgroundGeolocation.configure(config)
.subscribe((location: BackgroundGeolocationResponse) => {
this.zone.run(() => {
this.lat = location.latitude
this.lng = location.longitude
this.bearing = location.bearing
this.speed = location.speed
this.accuracy = location.accuracy
this.timestamp = location.time
})
this.backgroundGeolocation.finish(); // FOR IOS ONLY
this.backgroundGeolocation.stop()
});
this.backgroundGeolocation.start();
}
sendGPS(){
this.optionsService.sendGPS(gpsData).subscribe(result => {
}
})
}
stopTracking() {
this.sendGPS()
}
app.component.ts
constructor(){
this.sendGPSStart()
this.interval()
}
sendGPSStart(){
this.locationTracker.startTracking();
}
sendGPSStop(){
this.locationTracker.stopTracking();
}
interval(){
setInterval(() => {
this.sendGPSStart()
this.sendGPSStop()
}, '30000')
}
दुर्भाग्यवश, यह दृष्टिकोण केवल एंड्रॉइड में काम करता है। – userlkjsflkdsvm