Closed olofho closed 3 years ago
I have the same issue on Android emulator and a couple of physical phones.
We cannot pass Google Play Store review because Mapbox telemetry triggers request for background location - in contravention of Google's location policy - even though we do not use background or foreground location in the app.
@olofho, I was unable to replicate this within our example
app.
What's the reproduction rate for you? Does it always happen?
What I could imagine, is, that the Mapbox instance isn't initialized yet and this call: https://github.com/react-native-mapbox-gl/maps/blob/397482d4adc7e34cea30b39151c638e418a66f89/android/rctmgl/src/main/java/com/mapbox/rctmgl/modules/RCTMGLModule.java#L339
returns null
which then is a problem in the following line: https://github.com/react-native-mapbox-gl/maps/blob/397482d4adc7e34cea30b39151c638e418a66f89/android/rctmgl/src/main/java/com/mapbox/rctmgl/modules/RCTMGLModule.java#L340
Hi @ferdicus !
For me it is not intermittent, it happens on every launch. My app has a login screen and once log in is successful I navigate to a map-page that tries to set telemetry in componentDidMount()
which causes a crash on android. As a workaround I instead set telemetry when map finished loading which seems to work:
onDidFinishLoadingMap={() => MapboxGL.setTelemetryEnabled(false)}
Thank you for all the work you guys put on this library, I use it a lot and it's usually flawless!
I can corroborate @olofho 's results.
Basically, the MapboxGL object is always null when attempting MapboxGL.setTelemetry(false)
in Android only; it is fine in iOS.
I have run this method in a useEffect, componentDidMount and onDidFinishLoading
; in every case MapboxGL is definitely not null, but this is the error reported by react native.
Thanks again for your great work.
This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.
Hi,
I've experience same problem as @olofho just in Android 12. For me it work just fine in Android 10 & Android 11.
Versions (please complete the following information):
Platform: Android Platform OS: Android 12 Device: Android emulator & GooglePixel Emulator/ Simulator: Same error on both Dev OS: Windows 10 Pro react-native-mapbox-gl Version: 8.5.0 React Native Version: 0.63.4
Also as @airburst described moving MapboxGL.setTelemetryEnabled(false)
to onDidFinishLoadingMap
, useEffect
or componentDidMount
doesn't help. Telemetry object is always null and it causes application crash.
Can we reopen this issue?
Same problem with many users of ours, in Android. Can you please reopen this? Thanks.
The issue seems to only occur in Android 12. Mapbox upgraded telemetry dependency to 8.1.0 to be compatible with Android 12 so I did the same.
https://github.com/mapbox/mapbox-gl-native-android/blob/main/CHANGELOG.md#962---july-7-2021
Adding this implementation 'com.mapbox.mapboxsdk:mapbox-android-telemetry:8.1.0'
to android/app/build.gradle
fixed my problem.
I'm still getting this issue on "@react-native-mapbox-gl/maps": "^8.6.0-beta.0"
Also getting this error using useEffect
Hello, we are also having this issue, do you need any info?
Any update on this issue? Happened in Android 12 only. Using 8.5.0
Still an issue on Android 12 using 8.5.0 and 8.6.0beta.0 as well.
Describe the bug
Calling
MapboxGL.setTelemetryEnabled(boolean)
crashes on android.To Reproduce
Call
MapboxGL.setTelemetryEnabled(boolean)
incomponentDidMount()
Example:
Expected behavior
Telemetry to be set to false and map to function
Actual behavior
iOS works fine. On Android app crashes with following exception:
Screenshots
Versions (please complete the following information):