我有一个按钮,可以通过意图在我的设备上启动谷歌地图应用程序。我希望能够向它传递一个生成 KML 文件的 php 页面。
在 JS 中使用 googlemaps api 之前,我已经在网站上完成了此操作 - 但它似乎不适用于 Android。
我的php文件如下;
<?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>';
?>
启动:
final Intent myIntent = new Intent(android.content.Intent.ACTION_VIEW,
Uri.parse("geo:0,0?q=http://website.com/kml_gen.php"));
startActivity(myIntent);
它启动地图,找到文件 - 但不会显示它,“因为它包含错误”。
这是不可能的,还是有其他方法可以构建可能有效的意图?