Okay, then answering to the original question “how to rotate the map” is that use map.animateCamera()
or map.setCameraBearing()
.
animateCamera()
let cameraPosition: CameraPosition = this.map.getCameraPosition();
cameraPosition.bearing = 90; // heading of the map
this.map.animateCamera(cameraPosition);
or
this.map.setCameraBearing(90); // changing the map heading without animation
There is no function to change map heading automatically.
Thus you need to control the map camera from your code.
In order to get the device heading, you might be able to use this.
https://cordova.apache.org/docs/en/latest/reference/cordova-plugin-device-orientation/