How to find my current location (latitude + longitude) in every 5 second in Android?

后端 未结 4 1738
无人共我
无人共我 2021-01-26 01:45

I tried many code snippets but all the example takes too much time to provide latitude and longitude .

I want to get current latitude in every 5 seconds .

4条回答
  •  南笙
    南笙 (楼主)
    2021-01-26 01:57

    You can use FusedLocationProviderAPI to make your application location aware. Using the Google Play services location APIs, your app can request the last known location of the user's device. In most cases, you are interested in the user's current location, which is usually equivalent to the last known location of the device.

    For receiving most accurate location updates you can use this solution. https://developer.android.com/training/location/index.html

提交回复
热议问题