views:

432

answers:

3

I'm trying to get and display a live .kml file from maps.google.com using

Uri.parse("geo:0,0?q=http://maps.google.com/maps/ms?ie=UTF8&hl=en&msa=0&msid=104538451667315338387.0004887d133ba2ab6eec9&ll=42.029611,-93.646109&spn=0.011396,0.022724&z=16l&output=kml");

Intent mapIntent = new Intent(Intent.ACTION_VIEW, mapUri);

startActivity(Intent.createChooser(mapIntent, "lol"));

However after opening the mapview I get a notification saying "The community map could not be displayed because it contains errors"

I only get this error if I download the .kml directly from maps.google. If I copy the exact same link into my address bar, download the .kml file, and upload it elsewhere then it works fine. I would like to be able to get the maps directly from Google that way I can make a change and it would be immediately reflected to my users.

+1  A: 

try to display Android-downloaded data as text somewhere (i.e. thru System.out.println), maybe it contains google error message description

zed_0xff
How would I do that? not familiar with that and googling "Android-downloaded" returns where to download android..
John Moffitt
zed_0xff
John Moffitt
A: 

What if you create the intent with just the plain maps.google.com link, without the "&output=kml"?

Steve
John Moffitt
A: 

I solved this a while ago and figured I would update for anyone else facing this problem. The solution I used was copying the link to the custom map, appending &output=kml , and using a link shortening service. For some reason android just does not like the URL that google maps gives, and it has absolutely no problem with the file itself.

This is far from an elegant solution, as I am relying on both Google Maps and My URL shortener of choice to work to get the KML file to the user's phone. If either of them fails then my system won't work.

I am open to other options and will change my answer if another arises.

John Moffitt