संग्रह की मदद से व्यवस्थित रहें अपनी प्राथमिकताओं के आधार पर, कॉन्टेंट को सेव करें और कैटगरी में बांटें.
इस दस्तावेज़ में, Android के लिए Maps SDK का इस्तेमाल करने की ज़रूरी शर्तें बताई गई हैं. साथ ही, इसे चालू करने और पुष्टि किया गया अनुरोध करने का तरीका बताया गया है.
checklist
पक्का करें कि आपने ज़रूरी शर्तें पूरी की हों.
settings
अपने Google Cloud प्रोजेक्ट में एसडीके चालू करें.
verified_user
Maps SDK for Android के साथ इस्तेमाल करने के लिए, एपीआई पासकोड कॉन्फ़िगर करें.
[[["समझने में आसान है","easyToUnderstand","thumb-up"],["मेरी समस्या हल हो गई","solvedMyProblem","thumb-up"],["अन्य","otherUp","thumb-up"]],[["वह जानकारी मौजूद नहीं है जो मुझे चाहिए","missingTheInformationINeed","thumb-down"],["बहुत मुश्किल है / बहुत सारे चरण हैं","tooComplicatedTooManySteps","thumb-down"],["पुराना","outOfDate","thumb-down"],["अनुवाद से जुड़ी समस्या","translationIssue","thumb-down"],["सैंपल / कोड से जुड़ी समस्या","samplesCodeIssue","thumb-down"],["अन्य","otherDown","thumb-down"]],["आखिरी बार 2025-08-22 (UTC) को अपडेट किया गया."],[[["\u003cp\u003eAn API key is required to use the Maps SDK for Android and can be created through the Google Cloud Console or the Cloud SDK.\u003c/p\u003e\n"],["\u003cp\u003eBefore using the API key in production, it's crucial to restrict it for security by specifying allowed Android apps and APIs.\u003c/p\u003e\n"],["\u003cp\u003eRestricting the API key involves providing the package name and SHA-1 certificate fingerprint of your Android application.\u003c/p\u003e\n"],["\u003cp\u003eThe same API key can be used for both the Maps SDK for Android and Places SDK for Android applications.\u003c/p\u003e\n"],["\u003cp\u003eAfter obtaining and restricting the API key, proceed to set up and configure your Android Studio project.\u003c/p\u003e\n"]]],["To use the Maps SDK, you need an API key, created via the Google Cloud Console or Cloud SDK. The Console method involves navigating to the Credentials page and creating an API key. The Cloud SDK uses the `gcloud services api-keys create` command. Restrict API keys for security, selecting \"Android apps\" and adding the package name and SHA-1 certificate fingerprint. Use separate keys for each app and platform. You can also do this using Cloud SDK, with `gcloud services api-keys update`.\n"],null,["Select platform: [Android](/maps/documentation/android-sdk/get-api-key \"View this page for the Android platform docs.\") [iOS](/maps/documentation/ios-sdk/get-api-key \"View this page for the iOS platform docs.\") [JavaScript](/maps/documentation/javascript/get-api-key \"View this page for the JavaScript platform docs.\")\n\nBefore you begin\n\nBefore you start using the Maps SDK for Android, you need a project with a billing account and the\nMaps SDK for Android enabled. To learn more, see [Set up in Cloud console](/maps/documentation/android-sdk/cloud-setup).\n\nCreating API keys\n\nThe API key is a unique identifier that authenticates requests associated with your project for\nusage and billing purposes. You must have at least one API key associated with your project.\n\nTo create an API key:\n\nConsole \n\n1. Go to the **Google Maps Platform \\\u003e Credentials** page.\n\n [Go to the Credentials page](https://console.cloud.google.com/project/_/google/maps-apis/credentials?utm_source=Docs_CreateAPIKey&utm_content=Docs_maps-android-backend)\n2. On the **Credentials** page, click **Create credentials \\\u003e API key** . \n The **API key created** dialog displays your newly created API key.\n3. Click **Close.** \n The new API key is listed on the **Credentials** page under **API keys** . \n (Remember to [restrict the API](/maps/api-security-best-practices#restricting-api-keys) key before using it in production.)\n\nCloud SDK \n\n```bash\ngcloud services api-keys create \\\n --project \"\u003cvar translate=\"no\"\u003ePROJECT\u003c/var\u003e\" \\\n --display-name \"\u003cvar translate=\"no\"\u003eDISPLAY_NAME\u003c/var\u003e\"\n```\n\nRead more about the\n[Google Cloud SDK](https://cloud.google.com/sdk)\n,\n[Cloud SDK installation](https://cloud.google.com/sdk/docs/install)\n, and the following commands:\n\n- [`gcloud services api-keys create`](https://cloud.google.com/sdk/gcloud/reference/services/api-keys/create)\n| **Note:** You can use the same API key for your [Maps SDK for Android](/maps/documentation/android-sdk) and [Places SDK for Android](/maps/documentation/places/android-sdk) apps.\n\nRestricting API keys\n\nGoogle strongly recommends that you restrict your API keys by limiting their usage to those only\nAPIs needed for your application. Restricting API keys adds security to your application by\nprotecting it from unwarranted requests. **You are financially responsible for charges caused by abuse of unrestricted API keys.** For more information, see\n[API security best practices](/maps/api-security-best-practices#restrict_apikey).\n\n| When restricting an API key in the Cloud console, **Application restrictions** override any APIs enabled under **API restrictions**. Follow best practices by creating a separate API key for each app, and for each platform on which that app is available.\n\nWhen you restrict your API key, you must provide the SHA-1 certificate fingerprint of the\nsigning key that was used to sign the application. There are two certificate types:\n\n- **Debug certificate**: Only use this certificate type with apps you're testing and other non-production code. Do not attempt to publish an app that's signed with a debug certificate. The Android SDK tools generate this certificate automatically when you run a debug build.\n- **Release certificate**: Use this certificate when you're ready to release your app to an app store. The Android SDK tools generate this certificate when you run a release build.\n\nFor more information about Android application signing and certificates, see the\n[Sign your app](https://developer.android.com/tools/publishing/app-signing.html)\nguide.\n\nFor instructions on how to find your signing certificate fingerprint, see the references below:\n\n\n- If you're using **Play App Signing** , see [Working with API Providers](https://developer.android.com/studio/publish/app-signing#api-providers).\n- If you manage your own signing key, see [Self-signing your application](https://developers.google.com/android/guides/client-auth#self-signing_your_application) or refer to the instructions for your build environment.\n\nTo restrict an API key:\n\nConsole\n\n1. Go to the **Google Maps Platform \\\u003e Credentials** page.\n\n [Go to the Credentials page](https://console.cloud.google.com/project/_/google/maps-apis/credentials?utm_source=Docs_RestrictAPIKey&utm_content=Docs_maps-android-backend)\n2. Select the API key that you want to set a restriction on. The API key property page appears.\n3. Under **Key restrictions**, set the following restrictions:\n - Application restrictions:\n 1. Select **Android apps**.\n 2. Click **+ Add package name and fingerprint**.\n 3. Enter your package name and SHA-1 certificate fingerprint. For example: \n\n ```\n com.example.android.mapexample\n ``` \n\n ```\n BB:0D:AC:74:D3:21:E1:43:67:71:9B:62:91:AF:A1:66:6E:44:5D:75\n ```\n - API restrictions:\n 1. Click **Restrict key**.\n 2. Select **Maps SDK for Android** from **Select APIs** dropdown. If the Maps SDK for Android is not listed, you need to [enable](/maps/documentation/android-sdk/cloud-setup#enabling-apis) it.\n4. To finalize your changes, click **Save** . \n\nCloud SDK\n\n\nList existing keys. \n\n```bash\ngcloud services api-keys list --project=\"\u003cvar translate=\"no\"\u003ePROJECT\u003c/var\u003e\"\n```\n\n\nClear existing restrictions on existing key. \n\n```bash\ngcloud services api-keys update \"projects/\u003cvar translate=\"no\"\u003ePROJECT\u003c/var\u003e/keys/\u003cvar translate=\"no\"\u003eKEY_ID\u003c/var\u003e\" \\\n --clear-restrictions\n```\n\n\nSet new restrictions on existing key. \n\n```bash\ngcloud services api-keys update projects/PROJECT/locations/global/keys/KEY_ID \\\n --api-target=service=maps-android-backend.googleapis.com\n --allowed-application=sha1_fingerprint=SHA1_FINGERPRINT,package_name=ANDROID_PACKAGE_NAME\n```\n\nRead more about the\n[Google Cloud SDK](https://cloud.google.com/sdk)\n,\n[Cloud SDK installation](https://cloud.google.com/sdk/docs/install)\n, and the following commands:\n\n- [`gcloud services api-keys update`](https://cloud.google.com/sdk/gcloud/reference/services/api-keys/update)\n- [`gcloud services api-keys lookup`](https://cloud.google.com/sdk/gcloud/reference/services/api-keys/lookup)\n- [`gcloud services api-keys list`](https://cloud.google.com/sdk/gcloud/reference/services/api-keys/list)\n\nWhat's next\n\nNow that you have an API key, create and configure a project as described in\n[Set Up an Android Studio Project](/maps/documentation/android-sdk/config)."]]