Is there an easy way to get phone's compass heading accuracy in phonegap?

感情迁移 提交于 2019-12-11 15:19:01

问题


I am building an app for Android and ios with phonegap that includes a compass. Therefore I am using the w3c api as explained in this article

My problem is that the use of the compass is critical in my application so I need to make the user aware that his phone's compass has a problem whenever it is poorly calibrated.

I know for a fact that you can check the compass accuracy with native code in Java for Android. I don't know anything about Swift and ios.

My question is : Would you know any easy way to get the information about the compass accuracy with phonegap ? I've been searching a plugin to do that but I couldn't find anything really (except maybe for Android this plugin )

Thank you very much in advance


回答1:


Since it seems there were no possible answers to that question. I created the solution :

https://github.com/simsComputing/cordova-plugin-headingcalibration

This is my first cordova plugin so it surely is not perfect. It isn't published on npm yet. When I find time to complete it and publish it, i'll do it. In the mean time if anyone finds this thread, feel free to use the plugin.



来源:https://stackoverflow.com/questions/56158455/is-there-an-easy-way-to-get-phones-compass-heading-accuracy-in-phonegap

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!