使用Google Maps Api在我的应用上显示附近的地点

时间:2015-01-08 20:32:52

标签: android google-maps google-maps-android-api-2

我将其粘贴在我的应用上:

// Search for restaurants nearby
Uri gmmIntentUri = Uri.parse("geo:0,0?q=restaurants");
Intent mapIntent = new Intent(Intent.ACTION_VIEW, gmmIntentUri);
mapIntent.setPackage("com.google.android.apps.maps");
startActivity(mapIntent);

但它打开谷歌地图。怎么能在我的APP上做到这一点?

我希望在我的应用程序中显示附近的足球场。 像这样: 但没有搜索栏

enter image description here enter image description here

我找到了这个,但我不懂JavaScript: https://developers.google.com/maps/documentation/javascript/examples/place-search

1 个答案:

答案 0 :(得分:1)

您正在查看错误的文档。 JavaScript适用于网络等。

This on是for android。它是Google Maps Android API v2。

您无需启动谷歌地图意图。您需要创建自己的活动,获取谷歌地图片段。为此,您需要一个谷歌地图API密钥。再次,完成入门。我相信你可以在android studio中创建一个地图应用程序。试试那个