How to get current Location in GoogleMap using FusedLocationProviderClient

前端 未结 4 1474
南方客
南方客 2020-11-28 04:33

I want to get periodic (say every 2 minutes) current location updates for this I\'m following official documentation, I wrote this code but its not giving current location u

4条回答
  •  悲哀的现实
    2020-11-28 05:17

    For make it simple, try with this library https://github.com/mrmans0n/smart-location-lib. This will use the Fused Location Provider.

    You just put this code

    SmartLocation.with(context).location(new LocationBasedOnActivityProvider(callback))
        .start(new OnLocationUpdatedListener() { ... });
    

提交回复
热议问题