Share
Explore

Create a new project in the Google Cloud Console. Pre-req for Google Maps in Android.

See evernote for Android Maps Key:


image.png
To create a new project in the Google Cloud Console,
enable the Google Maps SDK for Android API,
and obtain an API key for integration into your Android project,
follow this detailed checklist of instructions:
1. **Access Google Cloud Console** - Visit the [Google Cloud Console](https://console.cloud.google.com/) using a web browser. - Sign in with your Google account credentials. If you don't have an account, you can create one for free.
2. Create a New Project → Get a Key to use in your KOTLIN CODE - Click on the project dropdown menu at the top of the page. - Select "New Project" from the menu. - Enter a name for your project and click "Create."
3. Enable Google Maps SDK for Android API

- In the Google Cloud Console dashboard, click on the menu icon in the upper left corner and select "APIs & Services" > "Library" from the sidebar.

- In the search bar, type "Google Maps SDK for Android API" and select it from the results. - Click the "Enable" button to enable the API for your project.

image.png

image.png

4. Create Credentials

- After enabling the API, go to the "Credentials" section in the sidebar. - Click on the "Create credentials" dropdown and choose "API key."
5. **Restrict the API Key (Optional but Recommended)** - For security purposes, you can restrict the usage of your API key. It's especially important if your app will be publicly available. - Click on your newly created API key to set restrictions.
6. **Set Application Restrictions (Optional)** - You can restrict your API key to be used only by specific Android apps. Add the package name of your app to restrict usage to only that app.

7. **Obtain the API Key**

- Once you have configured any restrictions, copy the generated API key.

8. Include the API Key in Your Android Project - Open your Android project in Android Studio. - Navigate to the `res` directory — LAYOUT FOLDER — and create a new XML file named `google_maps_api.xml` (or any other appropriate name). - Inside this file, add the following code and replace `YOUR_API_KEY_HERE` with the API key you obtained: ```xml ​<resources> <string name="google_maps_key" templateMergeStrategy="preserve" translatable="false">YOUR_API_KEY_HERE</string> </resources> ```

*resume here in next class**

9. **Reference the API Key in Your Android Manifest** - Open your AndroidManifest.xml file. - Add the following metadata tag inside the `<application>` tag to reference the API key: ```xml <meta-data android:name="com.google.android.maps.v2.API_KEY" android:value="@string/google_maps_key" /> ```
10. **Test the Integration** - Run your Android project on a device or emulator to ensure that the Google Maps SDK implementation is successful and the maps are displayed correctly.
By following this comprehensive checklist, you'll be able to create a new project in the Google Cloud Console, enable the Google Maps SDK for Android API, generate an API key, and integrate it into your Android project effectively.

Want to print your doc?
This is not the way.
Try clicking the ⋯ next to your doc name or using a keyboard shortcut (
CtrlP
) instead.