Open In App
Related Articles

How to Generate API Key for Using Google Maps in Android?

Improve Article
Save Article
Like Article

For using any Google services in Android, we have to generate an API key or we have to generate some unique key for using that service provided by Google. So Maps is one of the famous and most used services provided by Google. Maps can be seen in each and every app provided by Google and we also can use that service to add maps to our app. So in this article, we will take a look at the process of generating an API key for using Google Maps.

Step by Step Implementation

Step 1: Browse the below site on your browser

Click on this link to go to the Google Maps developer platform. You will get to see the below page. After click on the above link, you will get to see the below screen. Inside this click on the Go to Credentials page to go to the Credentials page for API key generation. 

After clicking on this option a new page will open inside that screen click on create a new project option in the top bar. 

Step 2: Creating a new project

To create a new project click on Create Project option as shown below.  

After clicking on create project option. You will get to see the below screen for creating a new project. 

Step 3: Add your name and organization for your project

Add your project name and organization name in the fields present on the screen. For testing, you can use you can provide a no organization option to proceed further.

 After adding your project name and organization name. Click on Create option to proceed further. 

Step 4: Create credentials for your API key

To create an API key for Maps click on Create credentials option and then select the API key option as shown below.

Click on the API key option to generate your API key. After clicking on this option your API key will be generated which is shown below. 

Now you can use this API for using maps. But this key is used by anyone in any of the projects. So we have to restrict the API key for our own project so that anyone cannot use this API key inside their app. 

Step 5: Restrict your API key

To restrict your API click on Restrict key option. After clicking on this option you will get to see the below screen. 

Inside this screen click on Android apps and click on Add an item option and after that, you will get to see the below screen. 

Inside this option, you have to add your app’s package name, the app’s SHA-1 certificate fingerprint, and click on the save option which is given below. After clicking on the save option your key is now restricted. Now you can use your key in google maps to add Google Maps to your app. You can refer to this article on How to Generate SHA-1 key for Android App in Android Studio. 

Whether you're preparing for your first job interview or aiming to upskill in this ever-evolving tech landscape, GeeksforGeeks Courses are your key to success. We provide top-quality content at affordable prices, all geared towards accelerating your growth in a time-bound manner. Join the millions we've already empowered, and we're here to do the same for you. Don't miss out - check it out now!

Last Updated : 24 Jan, 2021
Like Article
Save Article
Similar Reads