I have a button that launches the google maps app on my device via an intent. I want to be able to pass it a php page that generates a KML file.
I have done this on a website before using the googlemaps api in JS - but it doesn't seem to work on Android.
My php file is as follows;
<?php
echo '<kml xmlns="http://www.google.com/earth/kml/2">';
echo '<Placemark>';
echo '<name>Google Inc.</name>';
echo '<description>1600 Amphitheatre Parkway, Mountain View, CA 94043</description>';
echo '<Point>';
echo '<coordinates>-122.0841430, 37.4219720, 0</coordinates>';
echo '</Point>';
echo '</Placemark>';
echo '</kml>';
?>
Launching with:
final Intent myIntent = new Intent(android.content.Intent.ACTION_VIEW,
Uri.parse("geo:0,0?q=http://website.com/kml_gen.php"));
startActivity(myIntent);
It launches maps, finds the file - but won't display it 'because it contains errors'.
Is this just not possible, or are there other ways to construct the intent that might work?
Try setting the mimetype according to spec:
application/vnd.google-earth.kml+xml
Put this on the first line