Hi Guys. I am adding a single annotation to a map which I've set to draggable. I am then resetting the location and geocoding the new location when the pin is dropped allowing my user to move the location at their will. This all works well, but sometimes the pin is duplicating itself when its picked up leaving the original annotation in place...
var annotation = function(address, lat, lon){ // Now add our location var yourLocation = Alloy.Globals.Map.createAnnotation({ // animate: true, pincolor: Alloy.Globals.Map.ANNOTATION_RED, draggable: true, title:"Accident Location", subtitle: address.substring(0, 25)+'...', latitude: lat, longitude: lon }); $.mapview2.addAnnotation(yourLocation); $.mapview2.selectAnnotation(yourLocation); // Centre the map after 500ms (to bypass bug) setTimeout(function(){ $.mapview2.location = {latitude: lat, longitude: lon,latitudeDelta: 0.01,longitudeDelta: 0.01}; },500); }; $.mapview2.addEventListener("pinchangedragstate", function(e) { if(e.newState == 0) { // Set the subtitle to Loading, set the map to centre on the new location and geocode the new location. e.annotation.subtitle = 'Loading...'; $.mapview2.setLocation({latitude: e.annotation.latitude,longitude: e.annotation.longitude}); geocode(e.annotation.latitude,e.annotation.longitude); } });