1
我目前面临的问题不是很好。我已经创建了一个问题,但没有回应。我需要每个位置更改以更新相机中心位置。但是这并没有发生。刷新不能随着时间的推移而定义。这对我的需求来说非常罕见。 Android和iOS是一样的。日志被称为每分钟或类似的东西。 另外我试过在ngZone
之外的控制台日志,但它是一样的。 这是我的配置代码如下所示:Ionic 3:BackgroundLocation更新太少了
let config = {
desiredAccuracy: 0,
stationaryRadius: 1,
distanceFilter: 0,
debug: true,
interval: 2000,
pauseLocationUpdates: false,
activityType: "AutomotiveNavigation"
};
this.backgroundGeolocation.configure(config).subscribe((location) => {
// Run update inside of Angular's zone
this.zone.run(() => {
if(this.map) {
this.map.getMyLocation().then((userLocation: MyLocation) => {
console.log("INSIDE ZONE Google Maps Location \n LAT: " + userLocation.latLng.lat + "\nLNG: " + userLocation.latLng.lng);
this.userLocation = userLocation.latLng;
this.speed = userLocation.speed;
this.bearing = userLocation.bearing;
this.altitude = location.altitude;
this.cameraFollow();
this.notify(this.nearestReports[0]);
}).catch(error => {
alert("Background - NO GPS FOUND: " + error);
});
}
});
});
// Turn ON the background-geolocation system.
this.backgroundGeolocation.start();
但这个插件是不工作的背景位置是不是? – TdoubleG
老实说,我不确定。我检查了[Android如何处理后台位置服务](https://developer.android.com/reference/android/location/LocationManager.html#requestLocationUpdates(long,%20float,%20android.location.Criteria,%20android.app .PendingIntent))虽然(你使用的插件取决于),它说'位置更新之间的时间间隔永远不会小于minTime,尽管它可能更多取决于位置提供程序实现和其他应用程序请求的更新间隔'。所以在后台真的没有办法将它最小化。 – maninak
我希望这已经回答了你的问题。 – maninak