-
Notifications
You must be signed in to change notification settings - Fork 1.3k
Accessing LocationComponent.isLocationComponentEnabled() crashes the app since 7.4.0-Snapshot #14299
Comments
Actually, I am now using the new private fun enableLocationComponent() {
if (!PermissionsManager.areLocationPermissionsGranted(this)) {
Log.e(TAG, "Permissions should have, but were not granted")
return
}
val locationComponent = mapboxMap.locationComponent
mapboxMap.style?.let { style ->
val locationComponentOptions = LocationComponentOptions.builder(this).build()
val activationOptions = LocationComponentActivationOptions.Builder(this@MainActivity, style)
.locationComponentOptions(locationComponentOptions)
.build()
locationComponent.activateLocationComponent(activationOptions)
}
locationComponent.isLocationComponentEnabled = true
locationComponent.renderMode = RenderMode.COMPASS
// ...
} |
Thanks for reporting the issue @carstenhag. Per stack trace, you are checking if the component is enabled before activating it, so the crash is expected. That said, we realize that we did not expose a proper way to check for activation state, so #14262 is on the way to address that. Also, it's safe to activate the plugin without location permissions, those are required only when enabling it, #14311 on the way as well. |
So, to recap, I should proceed as following after #14311 is merged:
Is this right or did I get it wrong? Thanks in advance, you are very quick to answer! |
Sounds about right. You can also maintain your own flag that holds activation state if you'd like to keep current behavior (checking in the |
#14262 has landed, closing this one. |
Thanks :) Lovely to work with you.
Łukasz Paczos <notifications@github.com> schrieb am Mo., 8. Apr. 2019,
16:53:
… #14262 <#14262> has
landed, closing this one.
—
You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub
<#14299 (comment)>,
or mute the thread
<https://github.com/notifications/unsubscribe-auth/ADmh5bLgKRJ3vWQCPITJ8tmXp00pXlCrks5ve1fggaJpZM4cY45j>
.
|
Steps to reproduce
isLocationComponentEnabled()
method before having initialized the LocationComponent.Expected behavior
Actual behavior
I am unsure as on how to activate it now.
Configuration
Android versions: Android 9
Device models: One Plus 5
Mapbox SDK versions: Works with 7.3.0 and 7.3.0-Snapshot, broken with 7.4.0
The text was updated successfully, but these errors were encountered: