[TIMOB-16228] Android: Maps V2 selectAnnotation doesn't work before map complete event
GitHub Issue | n/a |
---|---|
Type | Bug |
Priority | Low |
Status | Reopened |
Resolution | Unresolved |
Affected Version/s | n/a |
Fix Version/s | n/a |
Components | Android |
Labels | android, ios, map, mapsv2, mapv2 |
Reporter | Mark Mokryn |
Assignee | Unknown |
Created | 2013-09-17T08:22:04.000+0000 |
Updated | 2018-02-28T20:03:13.000+0000 |
Description
The selectAnnotation method doesn't work before the complete event - see code below. Please fix or document this behavior.
index.xml:
<Alloy>
<Window>
<!-- Use the Alloy.Globals.Map namespace to create a map module view -->
<View id="mapview" ns="Alloy.Globals.Map"/>
</Window>
</Alloy>
index.tss:
"#mapview": {
mapType: Alloy.Globals.Map.NORMAL_TYPE,
animate:true,
regionFit:true,
userLocation:true
}
index.js:
// API calls to the map module need to use the Alloy.Globals.Map reference
var mountainView = Alloy.Globals.Map.createAnnotation({
latitude:37.390749,
longitude:-122.081651,
title:"Appcelerator Headquarters",
subtitle:'Mountain View, CA',
pincolor:Alloy.Globals.Map.ANNOTATION_RED
});
$.mapview.region = {latitude:37.390749, longitude:-122.081651,
latitudeDelta:0.05, longitudeDelta:0.05};
$.mapview.addAnnotation(mountainView);
$.mapview.selectAnnotation(mountainView); // DOES NOT WORK
/* Uncomment this to make it work
$.mapview.addEventListener('complete', function() {
$.mapview.selectAnnotation(mountainView);
});
*/
$.index.open();
alloy.js:
if (OS_ANDROID){
Alloy.Globals.Map = require('ti.map');
}
Hello Mark M, I tested your code. selectAnnotation method working for both case. So I cant reproduce your issue. If you are fetching this issue again please re-open this bug. Thanks
I'm not the only one seeing this issue: http://developer.appcelerator.com/question/156013/selectannotation-on-google-map-v2----android For me it occurred on two Nexus S devices - one running 4.1.2 and the other 2.3.6
This issue still exists, and now that iOS has also been transitioned to the map module in 3.2.0 it occurs on iOS as well. selectAnnotation is not reliable - sometimes opens the full annotation and sometimes not.