Getting location of a direction of current location in Android

孤者浪人 提交于 2019-12-12 01:47:46

问题


I want to implement a function that calculates locations' list (longitudes and latitudes) through a direction of my phone. The result can be a rectengular shape which is pointing the corners as locations.

First how can i find the device current direction which means which direction the back camera points ?

Then how can i obtain a list of location information through this direction ?

Thank you


回答1:


From the documentation of Google Maps Android API, the location data available to an Android device includes the current location of the device pinpointed using a combination of technologies - the direction and method of movement, and whether the device has moved across a predefined geographical boundary, or geofence.

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

For more information, check this tutorial:

  • Google Map Tutorial in Android Studio: How to get current location in Android Google Map

  • Google Map Tutorial in Android Studio



来源:https://stackoverflow.com/questions/38619091/getting-location-of-a-direction-of-current-location-in-android

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