PG1.5.0 Cordova - Google geocoding stops working

51 views
Skip to first unread message

Alessandro Annini

unread,
Mar 14, 2012, 4:39:08 AM3/14/12
to phon...@googlegroups.com
I'm using PhoneGap 1.5.0 Cordova,
I ask Google to geocode some data in json but after a few iterations it just stops working.
It's perfectly working with PhoneGap 1.4.1

Can you understand where the problem is? Did you already fixed it?

Here is the code:
_______________________________________

Geocoder: function() {
var serviceurl = 'http://maps.googleapis.com/maps/api/geocode/json', geocode, geocodeCoords, geocodeAddress;

geocode = function(req, cb) {
$.extend(req, {
sensor : true,
region : 'it',
language : 'it'
});
var qs = $.param(req);
$.ajax({
type: 'GET',
url : serviceurl,
data : qs,
success : function(d) {
cb(d.results, d.status);
},
error : function(xhr, status, e) {
alert('geocode error: ' + status);
console.log(e);
cb([], status || 'http error');
}
});
};

geocodeCoords = function(coords, cb) {
var req = {
latlng : [coords.latitude, coords.longitude].join(',')
};
geocode(req, function(arr, s) {
cb(arr, s);
});
};

geocodeAddress = function(addr, cb) {
var req = {
address : addr
};
geocode(req, function(arr, s) {
cb(arr, s);
});
};

/*
* 1: obj.coords => { latitude: 0, longitude: 0 } 2: obj.address =>
* string
*/
this.geocode = function(obj, cb) {
if (obj && obj.coords) {
geocodeCoords(obj.coords, cb);
} else if (obj && obj.address) {
geocodeAddress(obj.address, cb);
} else {
throw new Error('geocoder failure: nothing to geocode');
}
};

return this;
}
Message has been deleted

Manuel Paulo

unread,
Oct 17, 2013, 2:06:14 AM10/17/13
to phon...@googlegroups.com
I have the same problem. Have you fixed this?

Manuel Paulo

unread,
Oct 17, 2013, 2:06:48 AM10/17/13
to phon...@googlegroups.com
Reply all
Reply to author
Forward
0 new messages