Reputation: 41
I am trying to restrict a Google Maps API key so that they will only load on a specific Android app. If I use no restriction then the key works fine in the App, so I am 100% sure that the key is correct.
However when I add the restrictions to the API key in the Google Console then the maps stop loading on the app. I am following the correct instructions for restricting access to a specific package name (com.appname) and the correct finger print is used too.
This is a PhoneGap/Cordova app, so isn't a native Android App. Is this the reason why the restriction is not working?
Upvotes: 2
Views: 1817
Reputation: 1098
I literally cite the official documentation, based on @xomena comment:
Before moving your app or website to production, you should secure your API key. Keys for the Maps JavaScript API use the HTTP referrers (web sites) key restriction. Learn more about keys and credentials.
To add web browser restrictions to an existing, generic API key, do the following:
- Go to the Credentials page of the Google API Console.
- Select the project that contains the API key you want to edit.
- On the Credentials page, from the list of API keys, select the name of the API key to edit the details of the key.
- In the Key restriction section of the page, select HTTP referrers (web sites), follow the on-screen instructions to set referrers, then click Save.
Upvotes: 2