Problem description
I have a map view and a function for geolocalization.
The function works great: my map is centered in the user location and a blinking rounded indicator appears on the position.
The problem occurs when I change tab and I then go back in the tab with the map: the geolocalization works again but the blinking rounded indicator is disappeared!
Actual Results
The current user's location disappears.
Expected results
The current user's location is shown.
Test case
1. Add this code to a project
// this sets the background color of the master UIView (when there are no windows/tab groups on it)
Titanium.UI.setBackgroundColor('#000');
Ti.Geolocation.preferredProvider = "GPS demo";
Ti.Geolocation.preferredProvider = Titanium.Geolocation.PROVIDER_GPS;
Ti.Geolocation.purpose = "testing";
Titanium.Geolocation.accuracy = Titanium.Geolocation.ACCURACY_BEST;
Titanium.Geolocation.distanceFilter = 10;
// create tab group
var tabGroup = Titanium.UI.createTabGroup();
var win1 = Titanium.UI.createWindow({
title:'Tab 1',
backgroundColor:'#fff'
});
var tab1 = Titanium.UI.createTab({
icon:'KS_nav_views.png',
title:'Tab 1',
window:win1
});
var win2 = Titanium.UI.createWindow({
title:'Tab 2',
backgroundColor:'#fff'
});
var tab2 = Titanium.UI.createTab({
icon:'KS_nav_ui.png',
title:'Tab 2',
window:win2
});
var mapview = Titanium.Map.createView({
mapType: Titanium.Map.STANDARD_TYPE,
region:{latitude:41.65, longitude:12.98, latitudeDelta:1.5, longitudeDelta:1.5},
animate:true,
regionFit:true,
userLocation:true
});
//win1.add(mapview);
//geoLocalizzami();
var mapButton = Titanium.UI.createButton({
title: 'Add Map',
width:'200dp',
height:'200dp'
});
mapButton.addEventListener('click',function(e) {
win1.add(mapview);
});
win1.add(mapButton);
var geoLocalizzamiButton = Titanium.UI.createButton({
title: 'GeoLocalize',
width:'150dp',
height:'100dp',
top:'15dp'
});
geoLocalizzamiButton.addEventListener('click',function(e) {
geoLocalizzami();
});
mapview.add(geoLocalizzamiButton);
var label2 = Titanium.UI.createLabel({
color:'#999',
text:'I am Window 2',
font:{fontSize:20,fontFamily:'Helvetica Neue'},
textAlign:'center',
width:'auto'
});
win2.add(label2);
tabGroup.addTab(tab1);
tabGroup.addTab(tab2);
tabGroup.open();
// function to geo-localize
function geoLocalizzami(){
Titanium.Geolocation.getCurrentPosition(function(e) {
if (!e.success || e.error) {
var alertDialog = Titanium.UI.createAlertDialog({
title: '',
message: 'error',
buttonNames: ['OK']
});
alertDialog.show();
return;
}
var doveSono = {latitude:e.coords.latitude,longitude:e.coords.longitude,animate:true,latitudeDelta:0.3, longitudeDelta:0.3};
mapview.setLocation(doveSono);
});
}
Wait until the map shows the user's location.
Change tab
Go back to map's tab
The current user's location disappear.
do you have news about this bug?
Issue does not reproduces with Titanium Studio, build: 3.0.1.201212181159 Titanium SDK version: 3.1.0 (03/11/13 15:43 0c88429) Titanium SDK version: 3.0.2 (02/07/13 16:46 a4def81) Device: Samsung galaxy s duos Android version: 4.0.4
Closing ticket as the issue cannot be reproduced and due to the above comments.