phonegap cache locally google maps static image

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!


其实我有同样的问题,我通过将http://maps.google.com添加到应用程序白名单(Android中的res / config.xml文件,iPhone中的* .plist文件)

链接地址: http://www.djcxy.com/p/67530.html

上一篇: 静态地图升级不能添加控制和指示

下一篇: phonegap缓存本地谷歌地图静态图像