啟用 API
透過集合功能整理內容
你可以依據偏好儲存及分類內容。
如要在自己的應用程式中使用 Tuning Fork 程式庫,請在 Google Cloud 控制台中啟用 Android Performance Parameters API。您必須擁有 Google 開發人員帳戶,才能建立 Google Cloud 控制台專案。
您可以使用現有的 Google Cloud 控制台專案。請按照下列步驟,在現有專案中新增適當的 API 金鑰限制。
操作步驟
請按照下列步驟啟用 API:
在 Google Cloud 控制台中,前往「專案」頁面。選取現有專案或建立新專案。
前往「專案」頁面
如要進一步瞭解如何建立 Google Cloud 控制台專案,請參閱 Cloud API 說明文件。
為所選專案啟用 Android Performance Parameters API。
啟用 API
如果尚未啟用,請按一下「ENABLE」。
選取左側的「Credentials」分頁標籤。
如果專案目前沒有 API 金鑰,請按一下「CREATE CREDENTIALS」,然後選取「API Key」。
圖 1:建立 API 金鑰
複製 API 金鑰。稍後系統會將金鑰輸入至 Unity 外掛程式。
將 API 金鑰限制在僅限 Android 應用程式:
- 系統應該會顯示「Key restrictions」部分。如未顯示,請按兩下 API 金鑰。
- 在「Application restrictions」下方,選取「Android apps」。
- 按一下「ADD AN ITEM」。
- 輸入應用程式的套件名稱。
輸入 SHA-1 憑證指紋以驗證應用程式。請使用發布憑證指紋:
keytool -exportcert -list -v \
-alias your-key-name -keystore path-to-production-keystore
圖 2:將金鑰限制在僅限 Android 應用程式
將 API 金鑰限制在 Android Performance Parameters API:
- 在「API restrictions」下方,選取「Restrict key」。
- 從清單中選取「Android Performance Parameters API」。
圖 3:將金鑰限制在 Android Performance Parameters API
請務必按一下「Save」來啟用限制。
隱私權
請詳閱應用程式的隱私權政策,確保政策能正確反映出裝置和使用資料可能會分享給 Google。《Google API 服務條款》第 3.b 節規定如何使用 Android Performance Parameters API,根據此條款,您必須:
「遵守所有適用的隱私權法律和法規,包括適用於 PII 的法律和法規。您將為 API 用戶端提供《隱私權政策》並加以遵循,其中清楚明確地向使用者說明 API 用戶端收集了哪些使用者資訊,以及您如何使用及與 Google 和第三方分享這類資訊 (包括廣告用途的資訊)。」
這個頁面中的內容和程式碼範例均受《內容授權》中的授權所規範。Java 與 OpenJDK 是 Oracle 和/或其關係企業的商標或註冊商標。
上次更新時間:2025-08-26 (世界標準時間)。
[null,null,["上次更新時間:2025-08-26 (世界標準時間)。"],[],[],null,["To use the Tuning Fork library in your own app, enable the Android\nPerformance Parameters API in the Google Cloud Console. You need a Google\ndeveloper account to create a Google Cloud Console project.\n\nYou can use an existing Google Cloud Console project. Follow\nthe steps below to **add the proper API key restrictions** to your existing\nproject.\n\nSteps\n\nFollow these steps to enable the API:\n\n1. In the Google Cloud Console, go to the **Projects** page. Select an\n existing project or create a new project.\n\n [Go\n to the Projects Page](https://console.cloud.google.com/project)\n\n For more information on creating a Google Cloud Console project, see the\n [Cloud API documentation](https://cloud.google.com/apis/docs/getting-started).\n2. Enable the Android Performance Parameters API on the project you selected.\n\n [Enable\n the API](https://console.cloud.google.com/apis/api/performanceparameters.googleapis.com/overview)\n\n If it has not been enabled, click **ENABLE**.\n3. Select the **Credentials** tab on the left.\n\n4. If the project does not have an existing API key, click **CREATE\n CREDENTIALS** and select **API Key**.\n\n\n **Figure 1.** Create an API key\n5. Copy the API\n key. Later, you will input it into the Unity plugin.\n\n6. Restrict the API key to Android apps only:\n\n 1. You should see a **Key restrictions** section. If not, double-click the API key.\n 2. Under **Application restrictions** , select **Android apps**.\n 3. Click **ADD AN ITEM**.\n 4. Enter your app's package name.\n 5. Enter the SHA-1 certificate fingerprint to\n [authenticate your app](https://developers.google.com/android/guides/client-auth).\n Use the release certificate fingerprint:\n\n ```\n keytool -exportcert -list -v \\\n -alias your-key-name -keystore path-to-production-keystore\n ```\n\n\n **Figure 2.** Restrict the key to Android apps only\n7. Restrict the API key to the Android Performance Parameters API:\n\n 1. Under **API restrictions** , select **Restrict key**.\n 2. Select **Android Performance Parameters API** from the list.\n\n\n **Figure 3.** Restrict the key to the Android Performance Parameters API\n8. Make sure to click **Save** to enable the restrictions.\n\nPrivacy\n\nReview your app's Privacy Policy to ensure that it appropriately reflects that\ndata about devices and usage may be shared with Google. Under Section 3.b the\n[Google APIs Terms of Service](https://developers.google.com/terms), which\ngoverns your use of the Android Performance Parameters APIs, you must:\n\n\"comply with all applicable privacy laws and regulations including those\napplying to PII. You will provide and adhere to a privacy policy for your API\nClient that clearly and accurately describes to users of your API Client what\nuser information you collect and how you use and share such information\n(including for advertising) with Google and third parties.\""]]