ui-mapbox icon indicating copy to clipboard operation
ui-mapbox copied to clipboard

Android does not show user location

Open tombien opened this issue 2 years ago • 9 comments

After last update, I dont know why, but I am not able to show user location on Android. I did not make any changes from last version. I am stuck with that... Plese do you have any tips?

tombien avatar Dec 07 '22 18:12 tombien

I find, that maybe problem is here (index.android.js) Snímek obrazovky 2022-12-07 v 21 42 46 "showUserLocationMarker 2" is logged, but "showUserLocationMarker 3" not - I think this function does not end with resolve and is interrupted here.

tombien avatar Dec 07 '22 20:12 tombien

@tombien can you try to add a try catch around that line and print the error?

farfromrefug avatar Dec 08 '22 14:12 farfromrefug

@farfromrefug yea I can: Error: java.lang.IncompatibleClassChangeError: Found interface com.google.android.gms.location.FusedLocationProviderClient, but class was expected (declaration of 'com.google.android.gms.location.FusedLocationProviderClient' appears in /data/app/~~EbH2EsGKlyepoHXJnLM-kQ==/disway.trails-a6kNhxXFYIdoRJueoem9Jw==/base.apk!classes2.dex)

tombien avatar Dec 08 '22 16:12 tombien

Hello, today I made as a workaround custom marker with blue dot icon. And I used NS Geolocation plugin and set a watchLocation to change markers coordinates. In XML template on map I made this: ios:showUserLocation="true" And the geolocation stuff I put into Application.android condition.

tombien avatar Dec 09 '22 13:12 tombien

@tombien you can look up the java.lang.IncompatibleClassChangeError on the web. Something is wrong with the mapbox lib it seems

farfromrefug avatar Dec 09 '22 13:12 farfromrefug

@farfromrefug yes, that is true, I will do it later. But I need to fix this very fast - so I made this with geolocation plugin for now. Nobody from contributors does not know, where is the problem?

tombien avatar Dec 09 '22 13:12 tombien

This happened to me too recently. I have my showUserLocation tag set to true, but when the map loads for the first time, asks for permissions and when approved, nothing happens, the map stays on its default coordinates and the user's blue dot never appears.

To me, what broke the plugin was updating the @nativescript/geolocation plugin to 8.1.0, since this also requires to set up googlePlayServicesVersion = "21.+".

Sticking to @nativescript/[email protected] and googlePlayServicesVersion = "16.+" keeps its functionality and the error disappears.

guillemc23 avatar Jan 13 '23 00:01 guillemc23

@farfromrefug It seems this incompatibility issue has been fixed since mapbox v10.10.0 so plugin might need to use latest libraries. https://github.com/mapbox/mapbox-maps-android/issues/1752#issuecomment-1354535597

CatchABus avatar Apr 14 '23 14:04 CatchABus

@CatchABus yes but i wont update the plugin myself since it became closed source and requires special setup to add your key to simply download the sdk. You can do it though but for me i ll stop at the last open sourced version of mapbox ;) I wont update that plugin anymore. Maybe i ll fork it one day if i need maplibre

farfromrefug avatar Apr 14 '23 15:04 farfromrefug