yayaa / LocationManager

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

location fetching every second #116

Closed balsikandar-shuttl closed 3 years ago

balsikandar-shuttl commented 3 years ago

In Emulator testing for Kitkat and Lollipop

Issue

below is my configuration

`

            val trackingDistance = 500f
            val interval = 10000

            val locationRequest = LocationRequest.create()
                .setPriority(LocationRequest.PRIORITY_HIGH_ACCURACY)
                .setInterval(interval)
                .setFastestInterval(interval)
                .setSmallestDisplacement(trackingDistance)

            val googleServiceConfiguration = GooglePlayServicesConfiguration.Builder()
                .locationRequest(locationRequest)
                .fallbackToDefault(true)
                .ignoreLastKnowLocation(true)
                .setWaitPeriod(TWO_SECONDS)
                .build()

            val defaultProviderConfiguration = DefaultProviderConfiguration.Builder()
                .requiredTimeInterval(interval)
                .requiredDistanceInterval(trackingDistance.toLong())
                .acceptableAccuracy(5.0f)
                .acceptableTimePeriod(FIVE_MINUTE)
                .setWaitPeriod(ProviderType.GPS, TWO_SECONDS)
                .build()

            val awesomeConfiguration = LocationConfiguration.Builder()
                .keepTracking(true)
                .useGooglePlayServices(googleServiceConfiguration)
                .useDefaultProviders(defaultProviderConfiguration)
                .build()

            locationManager = LocationManager.Builder(applicationContext)
                .configuration(awesomeConfiguration)
                .notify(this)
                .build()`
yayaa commented 3 years ago

I have just released the v2.4.1 containing the fix for the issue, please give it a try and feel free to re-open if not resolved.