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

Location not available in getUserLocation method

Open vahidvdn opened this issue 5 years ago • 7 comments

I use showUserLocation="true" in the markup (Angular template) but it doesn't show my location. Also when I call the method as following:

this.map.getUserLocation();

I get the following error:

ERROR Error: Uncaught (in promise): Location not available

Using nativescript 6.1

vahidvdn avatar Oct 24 '19 12:10 vahidvdn

@EddyVerbruggen Actually I have 2 events, locationPermissionGranted and locationPermissionDenied. And when I open the app, the second one gets fired.

vahidvdn avatar Oct 24 '19 13:10 vahidvdn

I found out this works in some android devices. I installed nativescript-geolocation plugin. It worked on my phone (with android 7). And doesn't work in another phone (with android 5)

The getUserLocation method doesn't work on my phone and works on the other phone mentioned above.

vahidvdn avatar Oct 25 '19 10:10 vahidvdn

@vahidvdn see #326

EdvaldoLima avatar Nov 11 '19 18:11 EdvaldoLima

@EdvaldoLima Thanks, I'm going to take a quick look at it. But even if it fixes the bug, the issue should be still open.

vahidvdn avatar Nov 11 '19 19:11 vahidvdn

Same problem here, showUserLocation="true" as well as getUserLocation() don't work at all. The "solution" in #326 looks too complex and temporary, and I don't understand why #326 is even closed.

DenisNP avatar Dec 09 '19 18:12 DenisNP

@DenisNP the issue #326 is still open, and also the solution proposed by mikkelmoerchkv has resolved the problem of user location for my app, with his changes now I can see the user pointer location

EDIT : finally the solution of mikkelmoerchkv is not working with android >= 9, so do not use it

GrEg00z avatar Dec 17 '19 12:12 GrEg00z

Hello all,

It seems that I've found same issue on Android version 9+. On IOS devices everything is working properly. Can someone confirm if he manage to fix it without installing additional external plugin in order to resolve getUserLocation issue?

Br, Zhi

zhitomir-oreshenski-mm avatar Dec 18 '19 12:12 zhitomir-oreshenski-mm