0
votes

I'm doing an app that shows a Google Map via their static image api. In case the user has connection the map is taken with usual url "http://maps.google.com/maps/api/staticmap?sensor=false&center=...". Then I set it to be downloaded with FileTransfer.download on background, so the next time the user comes will have the map with or without connection.

The problem is that I can download many images but not the Google Maps, it gives an "invalid url" and I guess its because all the crap that the url has (lots of parameters, colons, pipes...)

This is an error for example:

{"source":"http://maps.google.com/maps/api/staticmap?sensor=false&center=42.846452955175835,-1.9212391417618164&zoom=6&size=260x260&markers=color:blue|label:1|42.846452955175835,-1.9212391417618164&markers=color:blue|label:2|40.97136004517963,-5.682259444534338&path=color:0x0000ff|weight:5|42.846452955175835,-1.9212391417618164|40.97136004517963,-5.682259444534338","code":"2","target":"/var/mobile/Applications/5773FF17-42B9-4CA0-9159-E05462140067/Documents/com.test.images/img_place_22.jpg"}

Is there any way to handle this? The only option I've seen looking around is creating a proxy on my server that handles "pretty urls" but that would be a lot of middle man work for something this simple.

Thanks!

1
If you ask to the url just this string it works: maps.google.com/maps/api/… - lfergon
Unless your parameters are dynamic what about using a URL-shortner service, like goo.gl ? Your url would become goo.gl/EmdLm - chrisben
The url works like a charm :) The problem is when this is executed: ft.download(item.url, dlPath, function(){ ... It crashes saying it's and invalid url, most likely because of the characters on the url like pipes, ... - Iñigo Gorosabel

1 Answers

0
votes

Actually I had the same problem, I solved it by adding http://maps.google.com to the application whitelist (res/config.xml file in android, *.plist file in iphone I think)