Can I use Maps and host an API with the same API key

I'm tired of building an application that uses Google maps to show places and the Pace API to find places. but it is not possible to create an application with two different API keys in the manifest. So, I want to know if it is possible to access the Maps API and the Place API using the same API key.? or is there another way to do this.

+4
source share
5 answers

Yes! you can use the same key on both, and also you can use only one key for all google APIs

See the image below for a list of all google api and see the link.

enter image description here Now you need to enable all api, the API that you need in your application should be included here. see this

enter image description here

Note:

You need to create an API key for a specific platform on the platform for the different API keys that you must create. See below image

Android API Key Create New API

Now check out this link

+5
source

First of all, go to the Google Api Console and select your project enter image description here

And select the api you want to include, for example, Google Map Api or google place api. Turn on the api.

enter image description here

Add api key in manifest application tag, e.g.

<meta-data android:name="com.google.android.gms.version" android:value="@integer/google_play_services_version" /> <meta-data android:name="com.google.android.maps.v2.API_KEY" android:value="@string/map_api_key" /> 

if you use both Map and Geo Api. Then add geo api (it will work for both)

 <meta-data android:name="com.google.android.geo.API_KEY" android:value="@string/place_api_key" /> 
+4
source

Yes, you can use Same Key for both functions.

Note. Make sure that when you create the API Key you need to enable the Google Map and Google Places APIs.

By Google Console. Where did you create your project. This is it.

After that, Both APIs will work with the same API key.

EDIT 1:

  • Create a project using Link If you have not created your project in the Google Console .

  • Then, after selecting the created project from the list of projects that you have.

  • It will show you all the APIS List. From this Enable APIS , which you need to use in your project.

  • Then add the Generated API Key to Manifest Android . It.

+1
source
  • you need to create a project in Google Console
  • then enable both the Google Map api and the Google Places API From Google Console
  • and use this project in the manifest. both api work well.
+1
source

Source: https://habr.com/ru/post/1245417/


All Articles