Using the Google API to Show Map in an App
To use the Maps SDK for Android you must have an API key. The API key is a unique identifier that is used to authenticate requests associated with your project for usage and billing purposes.
Before using the Google API, you need to register your application, including your digitally signed .apk file’s public certificate in the Google Developers Console. To register the application, follow these steps.
- Go to the: Google Developers Console
- Create a new project OR select a project you created earlier in the Firebase Console.
- Click the menu button and select APIs & Services > Credentials.
- On the Credentials page, click Create credentials > API key. The API key created dialog displays your newly created API key.
- Click Close. The new API key is listed on the Credentials page under API keys.
(Remember to restrict the API key before using it in production.)
The popup window that displays the API key has a Restrict Key button that you can use to restrict the key from unauthorized use. In this tutorial, we won’t restrict the key, but for an app that you plan to push to production, you should definitely restrict access to it. Key restriction lets you specify which websites, IP addresses or apps can use this key. This can help prevent unauthorized use and quota theft.