yayaa / LocationManager

Simplify getting user's location for Android
806 stars 187 forks source link

Time interval not work #49

Closed pravinsenta closed 7 years ago

pravinsenta commented 7 years ago

@Override public LocationConfiguration getLocationConfiguration() { return new LocationConfiguration.Builder() .keepTracking(true) .askForPermission(new PermissionConfiguration.Builder().build()) .useGooglePlayServices(new GooglePlayServicesConfiguration.Builder() .askForGooglePlayServices(true) .askForSettingsApi(true) .failOnConnectionSuspended(true) .failOnSettingsApiSuspended(false) .ignoreLastKnowLocation(false) .setWaitPeriod(10 1000).build()) .useDefaultProviders(new DefaultProviderConfiguration.Builder() .requiredTimeInterval(10 1000) .requiredDistanceInterval(1) .acceptableAccuracy(5.0f) .acceptableTimePeriod(10 1000) .gpsMessage("Turn on GPS?") .setWaitPeriod(ProviderType.GPS, 10 1000) .setWaitPeriod(ProviderType.NETWORK, 10 * 1000).build()) .build(); }

I am using above code for update location 10 sec and 1-meter time and distance interval but it always updates after 1 minute.

yayaa commented 7 years ago

Could you also provide logs please? So that, i can actually see what's happening behind...

My best guess would be; you receive location updates from GooglePlayServicesProvider and you never reach to DefaultProviders which would mean, unless you provide your own LocationRequest object -and as far as i can see from your configuration, you don't- you will be using default defined by the library.

You can see the default implementation here

pravinsenta commented 7 years ago

Thanks for Guide, now it work fine.