PDA

View Full Version : Problem with GeoLocation class, help needed.



uhuru
8 Feb 2011, 2:08 AM
Hi. I'm developing a googlemaps aplication with SenchaTouch.

Now I've added a button that updates location on each click.

I'm testing it in my nexus one with android, and with Ripple (Chrome Plugin).

--------------------------------------------------------------------------------

Here's the code:

(button in the toolbar)

{
iconCls: 'locate',
handler: function(){
geo.updateLocation();
}

(geolocation object)


var geoMarker=null;
var geo = new Ext.util.GeoLocation({
autoUpdate: false,
listeners: {
locationupdate: function (geo) {
var posicion = new google.maps.LatLng(geo.latitude,geo.longitude);

if(geoMarker){
geoMarker.setPosition(posicion);
}
else{
map.map.panTo(posicion);
geoMarker = new google.maps.Marker({
map: map.map,
position: posicion,
title: 'current location',
icon: 'point.png'
});
}


},
locationerror: function ( geo,
bTimeout,
bPermissionDenied,
bLocationUnavailable,
message) {
if(bTimeout){
alert('Timeout occurred.');
}
else{
alert('Error occurred$$$.');
}
}
}
});


-------------------------------------------------------------------

I have 3 different cases, 1 works, 2 doesn't.

1) With Ripple extension I can specify a latitude and longitude. If I click the button with some different coordinates it works ok.

2) In Ripple, I enable the "Simulate GPS Timeout" checkbox. If I try then to update location it shows the alert in locationerror listener, the one with $ symbols.

3) In my nexus, with data connection and GPS enabled, I load my page and click the update button.
it shows another alert with "Error ocurred" but no the same of point "2".


--------------------------------------------------------------------------------------

Can anyone help with that? Thanks!

uhuru
9 Feb 2011, 12:27 AM
Hi again. Today. for some reason I don't know, the error in my nexus is the same that in case "2", when I check "Simulate GPS Timeout".

However if I try to get my location in nexus with GoogleMaps or other application, it works.

Any idea??


EDIT: .... obviously if i check "Simulate GPS Timeout in point "2" it won't work.. my mistake

Anyway the problem persists in my nexus, google maps sensor is set to true, I really can't see what's wrong.

uhuru
14 Feb 2011, 12:07 AM
Hi. I've found other posts similar to this but unanswered.. Does anyone have idea of what is happening?