ui-mapbox
ui-mapbox copied to clipboard
Unable to inject telemetry service
I am currently getting this error when map instantiate in Android
telemtry TypeError: Cannot read properties of null (reading 'setUserTelemetryRequestState')
I don't require telemetry for this service and the map is working fine but for the sake of having a "clean" implementation I tried adding
<service android:name="com.mapbox.services.android.telemetry.service.TelemetryService" />
into App_Resources/Android/src/main/AndroidManifest.xml in the application block as mentioned in the read me though no luck.
If someone finds something wrong with my attempt or has more information on how to make sure that the telemetry service is properly injected let me know thanks.
Ok for the sake of posterity;
We have finally figured out why this error occurs even if
<service android:name="com.mapbox.services.android.telemetry.service.TelemetryService" />
was injected in App_Resources/Android/src/main/AndroidManifest.xml in the tag application.
the check also requires a missing property in the project in this
packages/ui-mapbox/platforms/android/include.gradle line 17
if (project.hasProperty("mapboxTelemetryVersion")) {
def mapboxTelemetryVersion = project.hasProperty("mapboxTelemetryVersion") ? project.mapboxTelemetryVersion : "6.1.0"
implementation ("com.mapbox.mapboxsdk:mapbox-android-telemetry:$mapboxTelemetryVersion")
}
otherwise mapbox-android-telemetry won't be injected. I am not sure if this is a wrong check or intentional but anyway I added the property mapboxTelemetryVersion in the gradle.properties and now mapbox telemetry is properly injected.
Obviously to avoid crashes I have set mapboxTelemetryVersion to 6.1.0
App_Resources/Android/gradle.properties
mapboxTelemetryVersion=6.1.0
@MarkOdey thanks for reminding me of this. Yes it was intentional. only way to not have it if you dont want to. If i enable it by default, no way to disable it ...