HTML5 Geolocation Altitude

最后都变了- 提交于 2019-12-11 00:38:29

问题


I was playing with the html5 geolocation api for a project I'm working on.

Latitude and longitude are reported correctly but altitude is always returned as 'null'.

Testing device is Nexus 4 and 5, has anybody else had similar problems with this api?


回答1:


Absolutely! it appears to be an issue that may be browser specific. Since I develop on both IPhones and Android I make sure to try my HTML5 apps on the default browsers (Safari and Android's webBrowser). My new IPhone 5S picks up the altitude just fine, but my Samsung Galaxy S4 continues to display "null". I built a native Android app version of my program to make sure it wasn't a device issue. It comes back with my altitude just fine. No answer, but still researching as altitude is important to us as well.

I also just verified using Chrome browser on same phone (S4); no altitude unless using my native app.




回答2:


The reason altitude is returned null is because, the device in question is **not** using GPS for location. Only when GPS is used, you'll get a value for altitude. If location provider is cell network, it won't be able to tell your altitude; that makes sense. Also, some OS might not report altitude accuracy, while reporting altitude.



来源:https://stackoverflow.com/questions/26264608/html5-geolocation-altitude

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