How to get current Location in GoogleMap using FusedLocationProviderClient

前端 未结 4 1466
南方客
南方客 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:20

     mLocationCallback = new LocationCallback() {
            @Override
            public void onLocationResult(LocationResult locationResult) {
                super.onLocationResult(locationResult);
                currentLocation = locationResult.getLastLocation();
    
            }
        };
    

    this work for me.

提交回复
热议问题