Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Accurate current Location is invalid #58

Closed
khaboshama91 opened this issue Dec 12, 2021 · 10 comments
Closed

Accurate current Location is invalid #58

khaboshama91 opened this issue Dec 12, 2021 · 10 comments

Comments

@khaboshama91
Copy link

Describe the bug
The library doesn't support to get user current location and it's depend on google map location to retrieve the last known location, please can you solve it
@BirjuVachhani

To Reproduce
Steps to reproduce the behavior:
1- open app
2- request to get current location (Locus.getCurrentLocation())

Expected behavior
I expected to retrieve the user current location instead of the last known location

Smartphone (please complete the following information):

  • Any version
@rodneyrd
Copy link

rodneyrd commented Jan 3, 2022

up

1 similar comment
@tkasymuulu
Copy link

up

@amensia
Copy link

amensia commented Mar 17, 2022

up ;)

@rahulas
Copy link

rahulas commented Mar 23, 2022

Any update on this?

@khaboshama91
Copy link
Author

You can add the runtime permission.

        val appPerms = arrayOf(
            Manifest.permission.ACCESS_COARSE_LOCATION,
            Manifest.permission.ACCESS_FINE_LOCATION
        )
        activityResultLauncher.launch(appPerms)

private var activityResultLauncher: ActivityResultLauncher<Array<String>> = registerForActivityResult(
        ActivityResultContracts.RequestMultiplePermissions()
    ) { result ->
        var allAreGranted = true
        for (isEnabled in result.values) {
            allAreGranted = allAreGranted && isEnabled
        }
    }

@rahulas
Copy link

rahulas commented Mar 23, 2022

How does this work? Any explanation pls.

@rahulas
Copy link

rahulas commented Mar 23, 2022

Tried it but, it doesn't work. Still, showing the wrong location.

@ichsanudin98
Copy link

up

@amensia
Copy link

amensia commented Apr 21, 2022

My solution is to trigger 2 update instead
Locus.configure { request { this.numUpdates = 2 this.priority = LocationRequest.PRIORITY_HIGH_ACCURACY this.interval = 100 } }

@BirjuVachhani
Copy link
Owner

This should be fixed in v4.1.0. Feel free to reopen if it is not.

implementation 'com.github.BirjuVachhani:locus-android:4.1.0'

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

7 participants