在 Android 中获取当前位置方向的位置

Getting location of a direction of current location in Android

我想实现一个函数,通过 phone 的方向计算位置列表(经度和纬度)。结果可能是一个矩形形状,它指向角落作为位置。

首先如何找到设备当前方向,即后置摄像头指向哪个方向?

那我怎样才能通过这个方向获取位置信息列表呢?

谢谢

来自 Google 地图 Android API 的 documentation,Android 设备可用的位置数据包括已查明的设备的当前位置使用技术组合 - 移动的方向和方法,以及设备是否已移动到预定义的地理边界或地理围栏。

This is the 3 options that you can do with your app.

  • Using My Location layer that provides a simple way to display the device's location on the map. It does not provide data.

  • Using Google Play services Location API is recommended for all programmatic requests for location data.

  • And using the LocationSource interface allows you to provide a custom location provider.

By using this, you can also get the different information about the coordinates that you get

有关详细信息,请查看本教程: