I don't know if you have seen the amazing Mytrack update, but it allow to send a kml file to Google Earth app and display it inside the Google app (if installed, of course).
The source code is there: http://code.google.com/p/mytracks/source/browse/
but I cannot find the way to achieve such a thing.
I think I found something here: http://code.google.com/r/jshih-mytracks3/source/browse/MyTracks/src/com/google/android/apps/mytracks/io/file/SaveActivity.java?spec=svn5178eb75934b7f0c4c23ec26b7d79a0787de18b8&r=5178eb75934b7f0c4c23ec26b7d79a0787de18b8
else if (playTrack) {
Intent intent = new Intent()
.addFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP | Intent.FLAG_ACTIVITY_NEW_TASK)
.putExtra(GOOGLE_EARTH_TOUR_FEATURE_ID, KmlTrackWriter.TOUR_FEATURE_ID)
.setClassName(GOOGLE_EARTH_PACKAGE, GOOGLE_EARTH_CLASS)
.setDataAndType(Uri.fromFile(new File(savedPath)), GOOGLE_EARTH_KML_MIME_TYPE);
startActivity(intent);
The hardcoded way gives this code:
Intent intent = new Intent()
.addFlags(
Intent.FLAG_ACTIVITY_CLEAR_TOP
| Intent.FLAG_ACTIVITY_NEW_TASK)
.putExtra("com.google.earth.EXTRA.tour_feature_id","tour")
.setClassName("com.google.earth", "com.google.earth.EarthActivity")
.setDataAndType(Uri.fromFile(new File("/sdcard/test.kml")),
"application/vnd.google-earth.kml+xml");
startActivity(intent);
But the above code simply displays the path with the same result than this code:
Intent mapIntent = new Intent(Intent.ACTION_VIEW);
Uri uri1 = Uri.parse("file:///sdcard/test.kml");
mapIntent.setData(uri1);
startActivity(Intent.createChooser(mapIntent, "Sample"));
My objective is to get the same result, with a "play" button.