I am new to Android and so I may be missing some very basic things here.
I am trying to host custom KML files on a server behind my firewall and display those KML files on the Android emulator.
I started by writing a simple app that uses an Intent to display the overlay and pointing the app at geo:0,0?q=http://code.google.com/apis/kml/documentation/KML_Samples.kml. This works in the emulator.
Next I downloaded that KML file and posted it on my web server (Apache 2.2 on Fedora). I added an AddType directive for the .kml extension and restarted HTTPD.
When I point my simple app's Intent to my internally hosted KML file I get the error "The community map could not be displayed because it contains errors."
I added some code to try and download the KML file independently of the KML so I could check the status line and the like:
final HttpClient client = new DefaultHttpClient();
final HttpGet get = new HttpGet("http://mycompany.com/data/KML_Samples.kml");
try {
final HttpResponse resp = client.execute(get);
android.util.Log.e("MapOverlays", resp.toString());
} catch (Throwable t) {
android.util.Log.e("MapOverlays", "Exception", t);
}
With a breakpoint on the first Log message line I can inspect the results:
statusline = "HTTP/1.1 200 OK"
Content-Type: application/vnd.google-earth.kml+xml
Here's the Intent I'm using:
final Intent intent = new Intent(
android.content.Intent.ACTION_VIEW,
Uri.parse("geo:0,0?q=http://mycompany.com/data/KML_Samples.kml"));
startActivity(intent);
So the two main questions are
- What do I need to do to get KML loaded from a private server?
- What tools are available (if any) to determine what is wrong with what I've done (something more informative than "The community map...")?
Thanks