Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Android - How to open google maps with Intent and KML?

I need to open google maps using kml file wich already exists on sdcard. (/sdcard/example.kml)

I tried:

  • Open local KML File in Google Maps on Android

this answer is wrong, when click on link, maps open, but search for location "file:///sdcard/example.kml"

  • Using Intent:

This code throws ActivityNotFoundException:

Intent intent = new Intent(android.content.Intent.ACTION_VIEW,
        Uri.parse("file:///sdcard/example.kml"));
startActivity(intent);
  • I tried use setDataAndType method, but isnt works:

Another ActivityNotFoundException:

Intent intent = new Intent(Intent.ACTION_VIEW);
intent.setDataAndType(
         Uri.parse("file:///sdcard/example.kml"),
                   "application/kml");
startActivity(intent);
  • Other two unsolved topics about this issue:

Open local KML File in Google Maps on Android

Does the Android API support KML files?

Any idea how to open this kml?

Thank you!!!

like image 877
Rodrigo Avatar asked Nov 05 '22 11:11

Rodrigo


1 Answers

I´m using Locus Free (from the market), which is a map visor that has the capability to open .kml files like those captured from google maps, BUT as well as is capable to import the .kml file from google, it does not let you see the satelite view, only the markers that you have added to it and some terrain features like roads and geographical names.

like image 70
ADOLFO HERNANDEZ Avatar answered Nov 11 '22 11:11

ADOLFO HERNANDEZ