2017-11-20 41 views
10

आयनिक के लिए पृष्ठभूमि भौगोलिक स्थान प्लगइन अद्यतन नहीं हो रहा है। मैं चाहता हूं कि कार्यक्षमता प्रत्येक 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') 

} 

उत्तर

1

उदाहरण जैसे पर dnchia/Ionic3-Background-Geolocation आप पृष्ठभूमि पर अंतराल कॉन्फ़िगर हैं, साथ ही समय-समय पर अग्रभूमि के रूप में भेजने की तलाश में

gps.ts

startTracking(interval) { 

    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, 
     interval: interval 
    }; 

app.component.ts

interval = 30000; 

constructor() { 
    this.sendGPSStart() 
    this.interval() 
} 

sendGPSStart(){ 
    this.locationTracker.startTracking(this.interval); 
} 

sendGPSStop(){ 
    this.locationTracker.stopTracking(); 
} 

interval() { 
    setInterval(() => { 
    this.locationTracker.sendGPS(); 
    }, this.interval) 

} 
+0

दुर्भाग्यवश, यह दृष्टिकोण केवल एंड्रॉइड में काम करता है। – userlkjsflkdsvm

0

इस समय वहाँ परियोजनाओं GitHub पर इस बारे में बग रिपोर्ट कर रहे हैं:

देखें: https://github.com/transistorsoft/cordova-background-geolocation-lt/issues/548 और https://github.com/transistorsoft/cordova-background-geolocation-lt/issues/539

के निर्माता प्रोजेक्ट स्प्लैश स्क्रीन प्लगइन को हटाने का सुझाव देता है (कॉर्डोवा-प्लगइन-स्प्लैशस्क्रीन)

संबंधित मुद्दे