Home > database >  Whitelist an android application on Maps API Key
Whitelist an android application on Maps API Key

Time:08-16

I try to whitelist an application by using the SHA-1 signature instead of IPs (whitelist with ip is working).

The application is developed with Expo and signed with expo too. So by using the command expo credentials:manager I'm able to get the SHA-1 signature and by running expo build:android -t apk I can get the signed apk.

But when I run the application, in abd logcat I see that the API key is not allowed. What I'm doing wrong ?


enter image description here

EDIT: The generated APK is well signed: keytool -printcert -jarfile my-apk-signed.apk enter image description here

CodePudding user response:

After contacting the Google Maps support, the answer is that if we use the Directions API, it is not possible to whitelist it with the SHA-1.

If you are making Directions API requests in an Android app, it is recommended that you set up a back end server to act as a proxy for the app, and white list the IP of the backend server.

The best thing is to have 3 keys:

  • One for Android (protected with Android app package name and SHA-1)
  • One for iOS maps (protected by bundle ID)
  • And a third key for the Directions API
  • Related