How to use the new Device Orientation

In this the repo where the device orientation plugin is it says it’s deprecated and to use something else:

And this is a tutorial from Apache about how to access the compass but I don’t seem to be able to get it working:

Could someone give me a hand on implementing this in Ionic?