一个应用程序可以有2个或更多谷歌API密钥吗?

时间:2016-06-15 18:26:58

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

我想使用谷歌地图Android API和谷歌地图方向API,第一个明显用于谷歌地图,后者用于计算它们之间的距离,是否可以使用它们,如果有例子,那么如何如果您可以粘贴相同的链接,我将不胜感激。 在此先感谢。

1 个答案:

答案 0 :(得分:0)

这是可能的,因为您需要一个Android API密钥来加载活动上的地图,而服务器密钥则需要在两个点之间获取方向。

google_maps_api.xml

public class DirectionFinder {
private static final String DIRECTION_URL_API = "https://maps.googleapis.com/maps/api/directions/json?";
private static final String GOOGLE_API_KEY = "SERVER_KEY";
private DirectionFinderListener listener;
private String origin;
private String destination;
.....

DirectionFinder.java

:BUILD_NUMBER=>"There does not seem to be a CURRENT_PROJECT_VERSION key set for this project.  Add this key to your target's expert build settings."}

如果您要创建nagivation地图,请查看此SO question

来源:

  1. http://googlegeodevelopers.blogspot.com/2015/06/code-road-android-app-bike-with-map-on.html
  2. https://developers.google.com/maps/documentation/android-api/
  3. https://github.com/hiepxuan2008/GoogleMapDirectionSimple
  4. https://www.youtube.com/watch?v=CCZPUeY94MU