Reputation: 608
I want to get location of device so used this line:
mLocationManager.requestLocationUpdates(provider, 0, 0, mLocationListener);
I know what each parameter do work, but can't understand how does it get location even though parameter has 0 value.
Upvotes: 0
Views: 45
Reputation: 532
mLocationManager.requestLocationUpdates(provider, 0, 0, mLocationListener);
In this the first 0 represents "Minimum Time" between the updates whereas the second 0 "Minimum Distance" between the updates.Hence, if you set them both to zero then the location change would be updated more frequently without any limits.
Upvotes: 1
Reputation: 34250
According to documentation
requestLocationUpdates(String provider, long minTime, float minDistance, LocationListener listener)
Register for location updates using the named provider, and a pending intent.
Even if you using minTime = 0 and minDistance = 0 they will provide you location. So, location fetches every time without any specific interval and time. It is up to us what values we have used there.
In your case they will provide you location every time without waiting for specific interval or time.
Upvotes: 1