Android - 获取 phone 指向的方位(类似指南针)

Android - Get orientation (Compass like) where phone is pointing at

我有一组带有经度和纬度的标记(google 地图标记)。 我想创建某种类似于雷达的视图,它将这些标记显示为我以 45° 角朝它们的方向看的点。

你们知道我怎么说 "This marker is behind me, this marker is in front of me" 吗? 考虑到我的方向,我想我应该应用 cos 和 sin,但这太模糊了 atm。

希望你能帮忙:) 谢谢

我假设你已经知道你的位置和方向。然后,您可以使用 Google 地图几何库的 computeHeading() 方法在您当前的位置和点上计算标记阵列的方向。然后您可以根据您当前的方向调整这些值。