Android - RequestDenied
See original GitHub issueI realise this is probably something I’m doing wrong but I’ve been banging my head against this wall for many hours and I’m not sure how else I can open a discussion with you @TorbenK
I’ve Enabled the Places API, I’ve enabled Android Maps support, I’ve generated an Android Key and locked it to my package, verified the SHA-1 is correct and verified that the apk I’m using was signed correctly.
For the init calls in your sample you use:
GmsPlace.Init("YOUR API KEY");
GmsDirection.Init("YOUR API KEY");
Am I supposed to have 2 seperate API keys there or are they the same key? Right now I just seem to have the 1 key which I use for both (Credentials ->CreateCredentials->ApiKey->Android Key). I’ve also tried leaving off the GmsPlace call since I only really need the Direction Api.
I’ve also updated my Android.manifest with:
<meta-data android:name="com.google.android.geo.API_KEY" android:value="YOUR API KEY" />
Again, is this the same API KEY I’m using in the above 2 calls?
If doesn’t matter if I switch this to com.google.android.maps.v2.API_KEY instead of com.google.android.geo.API_KEY, I still get RequestDenied.
If I look in the Developer console at my Google Maps API usage, I can see that the calls are coming through and they all have ‘Success’ next to them. The Google Maps Directions API usage though has Client Errors (4xx) next to all of them though.
I was following the checklist from here: http://stackoverflow.com/a/25374435/10957 (Even though it’s for the web service)
Any other ideas? Is there a better error log I can look at to see what the real problem is?
Issue Analytics
- State:
- Created 8 years ago
- Comments:5 (5 by maintainers)
Top GitHub Comments
Alright, finally got it figured out.
For GmsPlace.Init and com.google.android.geo.API_KEY in the AndroidManifest.xml you have to use the Android Api key.
But for GmsDirection.Init you have to create a Browser key, otherwise you get the above error. It doesn’t make sense why that’s the case, since the Browser key needs no referrers set, which means anyone can do queries with your key, but that’s the only way I’ve gotten it to work 😕
Doh, yes, of course you need the browser key I simply use the browser API for the route calculation. Seems like I don’t know my own library.