import { DeviceOrientation, DeviceOrientationCompassHeading } from '@awesome-cordova-plugins/device-orientation/ngx';
constructor(private deviceOrientation: DeviceOrientation) { }
...
this.deviceOrientation.getCurrentHeading().then(
(data: DeviceOrientationCompassHeading) => console.log(data),
(error: any) => console.log(error)
);
var subscription = this.deviceOrientation.watchHeading().subscribe(
(data: DeviceOrientationCompassHeading) => console.log(data)
);
subscription.unsubscribe();