To use the Tuning Fork library in your own app, enable the Android Performance Parameters API in the Google Cloud Console. You need a Google developer account to create a Google Cloud Console project.
You can use an existing Google Cloud Console project (for example, the one you created for the demo app). Follow the steps below to add the proper API key restrictions to your existing project.
Follow these steps to enable the API:
In the Google Cloud Console, go to the Projects page. Select an existing project or create a new project.
For more information on creating a Google Cloud Console project, see the Cloud API documentation.
Enable the Android Performance Parameters API on the project you selected.
If it has not been enabled, click ENABLE.
Select the Credentials tab on the left.
If the project does not have an existing API key, click CREATE CREDENTIALS and select API Key.
Figure 1. Create an API key
Copy the API key into the
api_keyfield in the game project
Restrict the API key to Android apps only:
- You should see a Key restrictions section. If not, double-click the API key.
- Under Application restrictions, select Android apps.
- Click ADD AN ITEM.
- Enter your app's package name.
Enter the SHA-1 certificate fingerprint to authenticate your app. Use the release certificate fingerprint:
keytool -exportcert -list -v \ -alias your-key-name -keystore path-to-production-keystore
Figure 2. Restrict the key to Android apps only
Restrict the API key to the Android Performance Parameters API:
- Under API restrictions, select Restrict key.
- Select Android Performance Parameters API from the list.
Figure 3. Restrict the key to the Android Performance Parameters API
Make sure to click Save to enable the restrictions.