Skip to content

Instantly share code, notes, and snippets.

@Amimul100
Created August 13, 2014 08:47
Show Gist options
  • Save Amimul100/8988e7e05ef15f55cab7 to your computer and use it in GitHub Desktop.
Save Amimul100/8988e7e05ef15f55cab7 to your computer and use it in GitHub Desktop.
/*
Hi, I have tested this issue in Ti SDK 3.3.0.GA. Its working good.
Testing Environment:
Titanium SDK: 3.3.0.GA, 3.2.3.GA
Titanium CLI: 3.3.0-rc
Android 4.4.2 KitKat
Appcelerator Studio, build: 3.3.0.201406271159
Step to Reproduce
Create a sample Ti Alloy project from AppC Studio
Update alloy.js, index.js and index.xml file with test code
Run on Android device
Map V2 is working
*/
// Loads the map module, which can be referenced by Alloy.Globals.Map
Alloy.Globals.Map = require('ti.map');
function report(evt) {
Ti.API.info("Annotation " + evt.title + " clicked, id: " + evt.annotation.myid);
}
// API calls to the map module need to use the Alloy.Globals.Map reference
var mountainView = Alloy.Globals.Map.createAnnotation({
latitude: 23.8045117,
pincolor:Alloy.Globals.Map.ANNOTATION_BLUE,
longitude: 90.3607137,
title:"Bangladesh",
subtitle:'Dhaka-1216',
myid:1 // Custom property to uniquely identify this annotation.
});
$.mapview.region = {latitude: 23.8045117, longitude: 90.3607137,
latitudeDelta:0.01, longitudeDelta:0.01};
$.mapview.addAnnotation(mountainView);
$.index.open();
<Alloy>
<Window>
<!-- Use the Alloy.Globals.Map namespace to create a map module view -->
<View id="mapview" ns="Alloy.Globals.Map" onClick="report" />
</Window>
</Alloy>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment