【问题标题】:How to use 2 different google API's in one Android project?如何在一个 Android 项目中使用 2 个不同的 google API?
【发布时间】:2016-04-07 13:29:52
【问题描述】:

正如我提到的,我试图在我的项目中使用两个不同的谷歌 API, 第一个是Google GeoLoaction Api,第二个是AutoComplete Api。 问题是,它们都需要应用程序元数据中 Manifest.xml 的密钥,但是当我尝试添加两者时,第二个密钥会覆盖第一个。

<?xml version="1.0" encoding="utf-8"?>

<uses-permission android:name="android.permission.ACCESS_FINE_LOCATION" />

<application
    android:allowBackup="true"
    android:icon="@mipmap/ic_launcher"
    android:label="@string/app_name"
    android:supportsRtl="true"
    android:theme="@style/AppTheme">
    <activity android:name=".MapsActivity">
        <intent-filter>
            <action android:name="android.intent.action.MAIN" />

            <category android:name="android.intent.category.LAUNCHER" />
        </intent-filter>
    </activity>
    <meta-data
        android:name="com.google.android.geo.API_KEY"
        android:value="@string/google_maps_key" />

</application>

我还尝试在我的值中添加另一个字符串,但效果不佳。

【问题讨论】:

    标签: android google-geolocation


    【解决方案1】:

    AutocompleteGeoLocation Api 可以与同一个Api Key 一起使用。您只需在Manifest 中添加一次密钥。您只需在Google Developer Console 中启用所需的Api。

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2019-11-29
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多