开发者

android getBearing not functioning as expected

开发者 https://www.devze.com 2023-03-25 21:06 出处:网络
I apologise if this has been asked, my searches only found bits and pieces... OK, so my understanding of the API description of getBearing is that it will display 0 -> 180 degrees if you move from No

I apologise if this has been asked, my searches only found bits and pieces...

OK, so my understanding of the API description of getBearing is that it will display 0 -> 180 degrees if you move from North, through East, to South. If you move from North, through West, to South, it will display 0 -> -180 degrees.

This however doesn't seem to be the case, I just watched my bearing crank up to 300 degrees, which then asks the question, is it going N -> E -> S -> W (as one would expect) or N -> W -> S -> E (which I know it probably wouldn't...but google have done weirder things).

The only other thing I can think of is that the bearing 开发者_StackOverflow社区going past 180 is due to the accuracy.

Could someone please give some insight about if my line of thought is correct or not.


I'm not sure where you're getting that idea. Looking at the Location reference, the documentation for getBearing() says

Returns the direction of travel in degrees East of true North. If hasBearing() is false, 0.0 is returned.

So 90 would be East, 180 South, and 270 West. This means your 300 degrees is somewhat North of West.

0

精彩评论

暂无评论...
验证码 换一张
取 消