Skip to content

Error: Location not available #326

@EdvaldoLima

Description

@EdvaldoLima

I have the following code snippets:

In NativeScript-Vue.

<uses-permission android:name="android.permission.ACCESS_COARSE_LOCATION"/>
<uses-permission android:name="android.permission.ACCESS_FINE_LOCATION"/>
<Mapbox
      accessToken="TOKEN"
      mapStyle="streets"
      latitude="-5.852365494"
      longitude="-35.36503315"
      hideCompass="false"
      zoomLevel="12"
      showUserLocation="true" <!-- Not Working -->
      disableZoom="false"
      disableRotation="false"
      disableScroll="false"
      disableTilt="false"
      @mapReady="onMapReady($event)">
</Mapbox>
onMapReady(args) {
                args.map.addMarkers([
                    {
                        lat: -5.852365494,
                        lng: -35.36503315,
                        title: "U S F JOSE COELHO",
                        subtitle: "Rua José Coelho - CENTRO",
                        onCalloutTap: () => {
                            utils.openUrl("https://www.thepolyglotdeveloper.com");
                        }
                    }
                ]);

                args.map.getUserLocation().then(
                    function(userLocation) {
                        alert(userLocation.location.lat + ", " + userLocation.location.lng)
                        console.log("Current user location: " +  userLocation.location.lat + ", " + userLocation.location.lng);
                        console.log("Current user speed: " +  userLocation.speed);
                        alert()
                    }
                ).catch(e => {
                    alert("Error: " + e)  //Error: Location not available
                })
}

Screenshot_20190820-143149_myapp
Screenshot_20190820-143137_myapp

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions