My students and I are trying to build a little PWA app that requires showing which direction the user is facing – i.e., the compass heading.
We have been unable to find a solution that works reliably. The Cordova implementation of DeviceOrientation gives an error about “cordova_not_available”, and other things we’ve tried have given very poor compass direction results.
Has anyone out there in Ionicland solved this problem? If so, can you help?
Thanks. I tried this and got very poor results, at least on my phone… So, I was hoping for some others to say they’ve used it and it worked well for them. or to show me their code so i could see what I did wrong.
I found that I had other code in my app that was listening on window’s deviceorientation and the computing the heading from alpha, beta, etc., and that seemed to really screw things up. When I commented that code out, the above code worked.