We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
How to update user location. In my situation it's not working
<template> <Page class="page"> <ActionBar class="action-bar" title="Карта"> <NavigationButton text="Go Back" android.systemIcon="ic_menu_back" @tap="$router.push('/home')"/> </ActionBar> <StackLayout> <Button class="btn btn-primary" @tap="addMarker">Добавить устройство</Button> <Mapbox accessToken="" latitude="46.2" longitude="39.93" mapStyle="streets" zoomLevel="10" showUserLocation="true" disableZoom="false" disableRotation="true" disableScroll="false" disableTilt="false" ref="map" @mapReady="onMapReady($event)"> </Mapbox> </StackLayout> </Page> </template> <script> import Vue from 'nativescript-vue'; import * as utils from "utils/utils"; import * as dialogs from "ui/dialogs" Vue.registerElement("Mapbox", () => require("nativescript-mapbox").MapboxView) //import mapbox from 'nativescript-mapbox'; //var mapbox = require("nativescript-mapbox"); //const geoLocation = require("nativescript-geolocation"); /* geoLocation.isEnabled().then(enabled => { if (!enabled) { geoLocation .enableLocationRequest() .then(() => this.showLocation()); } else { // this.showLocation(); } });*/ export default { data () { return { }; }, methods: { addMarker(){ var locations; locations = this.$refs.map.nativeView.getUserLocation().then( function(userLocation) { userLat = userLocation.location.lat; userLon = userLocation.location.lng; /*dialogs.alert("Широта и долгота").then(()=> { //console.log("Широта и долгота есть:) "+ userLocation.location.lat + " " + userLocation.location.lng); });*/ //console.log("Current user speed: " + userLocation.speed); } ) this.$refs.map.nativeView.addMarkers([ { lat: 46, lng: 40, title: 'One-line title here', subtitle: 'Really really nice location', selected: true, // makes the callout show immediately when the marker is added (note: only 1 marker can be selected at a time) onCalloutTap: function(){console.log("'Nice location' marker callout tapped");} }] ); }, onMapReady(args) { /*args.map.addMarkers([ { lat: 37.7397, lng: -121.4252, title: "Tracy, CA", subtitle: "Home of The Polyglot Developer!", onCalloutTap: () => { utils.openUrl("https://www.thepolyglotdeveloper.com"); } } ]);*/ args.map.trackUser({ mode: "FOLLOW_WITH_COURSE", // "NONE" | "FOLLOW" | "FOLLOW_WITH_HEADING" | "FOLLOW_WITH_COURSE" animated: true }); } } }; </script> <style scoped></style>
Don't forget about mapbox token
The text was updated successfully, but these errors were encountered:
No branches or pull requests
How to update user location. In my situation it's not working
Don't forget about mapbox token
The text was updated successfully, but these errors were encountered: