O
O
OM12016-09-10 11:53:10
Android
OM1, 2016-09-10 11:53:10

Android Studio Google Maps: how to use mMap.getMyLocation() geolocation?

Hello!

private void setUpMap(GoogleMap map) {
        mMap = map;
        mMap.setMyLocationEnabled(true);
        Location myLocation  = mMap.getMyLocation();
}

Geolocation works, coordinates are determined.
BUT, gps works constantly, coordinates are updated continuously.
How to correctly get the coordinates through mMap.getMyLocation() at a given location in the code?
PS: what is the best way to determine the coordinates in the application: mMap.getMyLocation, locationManager, GoogleApiClient (LocationServices.API) or something else?

Answer the question

In order to leave comments, you need to log in

1 answer(s)
F
freeExec, 2016-09-12
@OM1

It doesn't work otherwise. You can of course set a predetermined interval, but it has little effect on the operation of the GPS itself. Because even a hot start can take up to a minute. And if the coordinates are needed here and now, even with an interval of 15 seconds, you will have to keep it constantly on.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question