Quantcast
Channel: Appcelerator Developer Center Q&A Unanswered Questions 20
Viewing all articles
Browse latest Browse all 8068

Appcelerator map current location

$
0
0

I am using map in a form to get the current location, the map is showing right but it's not getting the user's location here is my code

var Map = require('ti.map');
var mapview = Map.createView({
    mapType : Map.NORMAL_TYPE,
    animate : true,
    regionFit : true,
    userLocation : true,
    width : '85%',
    height : 200,
    top : 10,
    borderColor : 'red',
    borderWidth : 2
});
 
mapview.addEventListener('regionchanged', function(e) {
 
    mapview.removeAllAnnotations();
 
    var annot = Map.createAnnotation({
        latitude : e.latitude,
        longitude : e.longitude,
        // title : "Appcelerator Headquarters",
        pincolor : Map.ANNOTATION_RED,
        animate : true
    });
    //alert('Latitude >> ' + e.latitude + ' , Longitude >> ' + e.longitude);
    mapview.addAnnotation(annot);
});
// Handle click events on any annotations on this map.
mapview.addEventListener('click', function(evt) {
 
    Ti.API.info("Annotation " + evt.title + " clicked, id: " + evt.annotation.myid);
 
    // Check for all of the possible names that clicksouce
    // can report for the left button/view.
    if (evt.clicksource == 'leftButton' || evt.clicksource == 'leftPane' || evt.clicksource == 'leftView') {
        Ti.API.info("Annotation " + evt.title + ", left button clicked.");
    }
});

Viewing all articles
Browse latest Browse all 8068

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>