Crash if smartphone localization is disabled
Hey,
I don't know if this is a navigation issue or a general mapbox-java issue.
My setup on a Google Nexus 6 with Android 6.0 is:
compile ('com.mapbox.mapboxsdk:mapbox-android-sdk:5.1.0-beta.2@aar') { transitive = true exclude module: 'lost' exclude module: 'mapbox-java-geojson' exclude module: 'mapbox-android-telemetry' } compile('com.mapbox.mapboxsdk:mapbox-android-services:2.1.0@aar') { transitive = true } compile 'com.mapbox.mapboxsdk:mapbox-android-navigation:0.2.0'
If the user has allowed the smartphone to locate himself, everything work fine (app permissions for localisation are granted).
But if he disables the localisation, and I run the following code, the app crashes after I activate the location engine:
LocationEngine locationEngine = LocationSource.getLocationEngine(context); locationEngine.activate();
05-24 15:35:21.661 15330-15330/? W/System.err: java.lang.AbstractMethodError: abstract method "void com.mapzen.android.lost.api.LocationListener.onProviderDisabled(java.lang.String)"
05-24 15:35:21.662 15330-15330/? W/System.err: at com.mapzen.android.lost.internal.LostClientManager.reportProviderDisabled(LostClientManager.java:205)
05-24 15:35:21.662 15330-15330/? W/System.err: at com.mapzen.android.lost.internal.FusedLocationProviderServiceImpl.reportProviderDisabled(FusedLocationProviderServiceImpl.java:145)
05-24 15:35:21.662 15330-15330/? W/System.err: at com.mapzen.android.lost.internal.FusionEngine.onProviderDisabled(FusionEngine.java:214)
05-24 15:35:21.662 15330-15330/? W/System.err: at android.location.LocationManager$ListenerTransport._handleMessage(LocationManager.java:310)
05-24 15:35:21.662 15330-15330/? W/System.err: at android.location.LocationManager$ListenerTransport.-wrap0(LocationManager.java)
05-24 15:35:21.662 15330-15330/? W/System.err: at android.location.LocationManager$ListenerTransport$1.handleMessage(LocationManager.java:242)
05-24 15:35:21.662 15330-15330/? W/System.err: at android.os.Handler.dispatchMessage(Handler.java:102)
05-24 15:35:21.662 15330-15330/? W/System.err: at android.os.Looper.loop(Looper.java:154)
05-24 15:35:21.662 15330-15330/? W/System.err: at android.app.ActivityThread.main(ActivityThread.java:6077)
05-24 15:35:21.662 15330-15330/? W/System.err: at java.lang.reflect.Method.invoke(Native Method)
05-24 15:35:21.662 15330-15330/? W/System.err: at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:865)
05-24 15:35:21.662 15330-15330/? W/System.err: at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:755)
Best regards, Patrick
@zugaldia is this one of the LOST issues we've been seeing? Looks like in any case, this issue belongs in the Mapbox-Java repo.
@PatrickZenker Just a hunch, but I believe this is happening because you're including an incompatible version of LOST (per exclude module: 'lost' above). In its latest version, the onProviderDisabled method was removed from the LOST-provided interface. This is something LocationSource used to implement to comply with the older interface. I believe this is fixed in the upcoming 5.1 release.
Looks like in any case, this issue belongs in the Mapbox-Java repo.
Because this is using LocationSource it'd belong to https://github.com/mapbox/mapbox-gl-native.
Okay, thank you!