Skip to content
New issue

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

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

Already on GitHub? # to your account

Can't get location when phone is indoors (in building) #124

Open
LugovayaOksana opened this issue Jun 15, 2022 · 0 comments
Open

Can't get location when phone is indoors (in building) #124

LugovayaOksana opened this issue Jun 15, 2022 · 0 comments

Comments

@LugovayaOksana
Copy link

I don't have google services on my phone. So I am trying to use useDefaultProviders.
When the phone is in the building, I can't get the coordinates. When I go outside with my phone, I get the coordinates.

My settings for useDefaultProviders

val acceptableTimePeriod = 50L
val requiredTimeInterval = 50L
val requiredDistanceInterval = 15L
val acceptableAccuracy = 1000.0f
val setWaitPeriodGPS = 20 * 1000L
val setWaitPeriodNetwork = 20 * 1000L

val awesomeConfiguration = LocationConfiguration.Builder()
.keepTracking(true)
.useGooglePlayServices(
GooglePlayServicesConfiguration.Builder()
//.locationRequest(YOUR_CUSTOM_LOCATION_REQUEST_OBJECT)
.fallbackToDefault(true)
.askForGooglePlayServices(false)
.askForSettingsApi(true)
//.failOnConnectionSuspended(true)
.failOnSettingsApiSuspended(false)
.ignoreLastKnowLocation(false)
.setWaitPeriod(20 * 1000)
.build()
)
.useDefaultProviders(
DefaultProviderConfiguration.Builder()
.acceptableTimePeriod(acceptableTimePeriod)
.requiredTimeInterval(requiredTimeInterval)
.requiredDistanceInterval(requiredDistanceInterval)
.acceptableAccuracy(acceptableAccuracy)
//.gpsMessage("Turn on GPS?")
//.gpsDialogProvider(YourCustomDialogProvider())
.setWaitPeriod(ProviderType.GPS, setWaitPeriodGPS)
.setWaitPeriod(ProviderType.NETWORK, setWaitPeriodNetwork)
.build()
)
.build()

    locationManager = LocationManager.Builder(applicationContext)
        //.activity(this) // Only required to ask permission and/or GoogleApi - SettingsApi
        .configuration(awesomeConfiguration)
        .notify(MyLocationListener())
        .build()

    locationManager?.get()

Logs

In the logs, I see that the provider is asked
GETTING_LOCATION_FROM_NETWORK_PROVIDER

Please tell me why I can't get the coordinates when the phone is indoors? If it is possible to get it, then how to do it without Google services?
Thanks in advance.

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

No branches or pull requests

1 participant