Titanium JIRA Archive
Titanium SDK/CLI (TIMOB)

[TIMOB-16228] Android: Maps V2 selectAnnotation doesn't work before map complete event

GitHub Issuen/a
TypeBug
PriorityLow
StatusReopened
ResolutionUnresolved
Affected Version/sn/a
Fix Version/sn/a
ComponentsAndroid
Labelsandroid, ios, map, mapsv2, mapv2
ReporterMark Mokryn
AssigneeUnknown
Created2013-09-17T08:22:04.000+0000
Updated2018-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');
}

Comments

  1. Mostafizur Rahman 2013-09-18

    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
  2. Mark Mokryn 2013-09-18

    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
  3. Mark Mokryn 2013-12-23

    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.

JSON Source