Bearing or heading is not showing
Your Environment
- Plugin version: "@ionic-native/background-geolocation": "^5.30.0", @mauron85/cordova-plugin-background-geolocation (from github)
- Platform: Android
- OS version: 8.1.0
- Device manufacturer and model: Asus Zenfone Max (M2), ASUS_X01AD
- Running in Simulator:
- Cordova version (
cordova -v): 10.0.0 - Cordova platform version (
cordova platform ls): android 9.0.0 - Plugin configuration options:
- Link to your project:
Context
No bearing return using
- getCurrentLocation()
- on()
Expected Behavior
show bearing or heading inside BackgroundGeolocationResponse
Actual Behavior
Result:
accuracy: 12.63700008392334 altitude: 64.19999694824219 id: 1114 isFromMockProvider: false latitude: 3.2108753 locationProvider: 0 longitude: 101.7502981 mockLocationsEnabled: false provider: "network" time: 1610990715444
accuracy: 145.79200744628906 altitude: 64.076171875 id: 1113 isFromMockProvider: false latitude: 3.21087098 locationProvider: 0 longitude: 101.7502975 mockLocationsEnabled: false provider: "gps" time: 1610988678000
accuracy: 13.868000030517578 altitude: 63.900001525878906 id: 1115 isFromMockProvider: false latitude: 3.2108782 locationProvider: 0 longitude: 101.7503045 mockLocationsEnabled: false provider: "fused" time: 1610992146740
Possible Fix
Steps to Reproduce
const backgroundGeolocationCurrentPositionConfig: BackgroundGeolocationCurrentPositionConfig = {
timeout: Infinity,
maximumAge: 0,
enableHighAccuracy: true
}
this.backgroundGeolocation.getCurrentLocation(backgroundGeolocationCurrentPositionConfig).then((backgroundGeolocationResponse: BackgroundGeolocationResponse) => {
console.log('backgroundGeolocation getCurrentLocation', backgroundGeolocationResponse);
}).catch((error) => {
console.log('backgroundGeolocation getCurrentLocation error', error);
});
const config: BackgroundGeolocationConfig = {
desiredAccuracy: 0,
interval: 1000,
stationaryRadius: 1,
distanceFilter: 1,
debug: true, // enable this hear sounds for background-geolocation life-cycle.
stopOnTerminate: false // enable this to clear background location settings when the app terminates
};
this.backgroundGeolocation.configure(config).then(() => {
this.backgroundGeolocation.on(BackgroundGeolocationEvents.location).subscribe(async (backgroundGeolocationResponse: BackgroundGeolocationResponse) => {
console.log(backgroundGeolocationResponse);
const { latitude, longitude, speed, accuracy, time } = backgroundGeolocationResponse;
if (backgroundGeolocationResponse.speed == undefined) {
backgroundGeolocationResponse.speed = 0;
}
let timestamp = new Date(time);
console.log('latitude, longitude, speed, accuracy, time, timestamp', latitude, longitude, speed, accuracy, time, timestamp);
// IMPORTANT: You must execute the finish method here to inform the native plugin that you're finished,
// and the background-task may be completed. You must do this regardless if your operations are successful or not.
// IF YOU DON'T, ios will CRASH YOUR APP for spending too much time in the background.
}, async error => {
console.log('this.backgroundGeolocation.on error', error);
});
});
// start recording location
this.backgroundGeolocation.start();
Context
There is no bearing in gps, network, fused

The bearing or heading is not showing, how to fix this?