Google Maps Android Api V2 Key Generator

Posted : admin On 12.12.2020
  1. Google Maps Android Api V2 Key Generator Review
  2. Google Map Api Key Android

If you want to use Google Maps in your Xamarin.Android app, you will need to obtain an API key. It’s easy to generate an API Key, but we will also want to restrict it’s usage, so that only your app can use it. This alleviates the security concern of placing the API Key in your app, and someone taking it for their own use.

Create Google Maps API Key

  1. Go to the Google Developers Console
  2. Click Create Project (If you don’t already have one, otherwise it defaults to an existing project). If you have an existing project, but want to create a new one, click the drop down, then the + button.
  3. Click ENABLE APIS AND SERVICES
  4. Click Google Maps Android API
  5. Then click enable
  6. Click Credentials, in the Menu, then click Create credentials and select API key

Search the world's information, including webpages, images, videos and more. Google has many special features to help you find exactly what you're looking for.

This is your API key that you can use in your Android app.

In your AndroidManifest.xml file, inside the application tag, place your API Key.

Restrict Key Access

Check that android:name='com.google.android.maps.v2.APIKEY' android:value='your API key'/ is in the element of AndroidManifest.xml Having read Google Maps Android API V2 problems with android 4.3, and Android google Map Api V2 Crashes on runtime, I still have not had any luck in fixing my issue. Note: As shown above, com.google.android.geo.APIKEY is the recommended metadata name for the API key. A key with this name can be used to authenticate to multiple Google Maps-based APIs on the Android platform, including the Maps SDK for Android. For backwards compatibility, the API also supports the name com.google.android.maps.v2.APIKEY. You can now find the certificate fingerprint that is to be used while generating API key of Google Maps. Please take note of the SHA-1 address. After you have generated SHA-1, create a new project in Google APIs console. Doing so will add the Google Maps Android API v2 to your project. Google Cloud Platform lets you build, deploy, and scale applications, websites, and services on the same infrastructure as Google. Jun 27, 2018 This video is a step-by-step tutorial on how to get a Google Maps API key fast and with minimum effort.

This API Key is now available, but can be used with anyone who has access to it. If you are using it Server side, then the security issues aren’t too great. apple font book mac download However, if you need to distribute this with your app, then it is best to restrict this, so only your app can use it.

Generate Fingerprint

We first need to generate a fingerprint. This is done via the command or terminal line. And is in this format.

For windows, you will find the debug values for your keystore here, and the default path for the Java SDK. You will need to go to this path, in the commandline to run the keytool.

  • [STORE FILENAME] = C:Users[USERNAME]AppDataLocalXamarinMono for Androiddebug.keystore
  • C:Program Files (x86)Javajdk[VERSIONNUMBER]bin

For a Mac, they will be as follows.

  • [STORE FILENAME] = /Users/[USERNAME]/.local/share/Xamarin/Mono for Android/debug.keystore
  • /System/Library/Java/JavaVirtualMachines/[VERSIONNUMBER].jdk/Contents/Home/bin/keytool

The debug values you will also want are

  1. [ALIAS NAME] = androiddebugkey
  2. [STORE PASSWORD] = android
  3. [KEY PASSWORD] = android

Here is an example, for myself in Windows.

The example output, you will get is.

What you want is the SHA-1 signature.

Add App Restriction

Now, lets go back to the developer console.

Google Maps Android Api V2 Key Generator Review

  1. Edit the API Key.
  2. Add the fingerprint, and your Xamarin.Android apps package name, and save.

Google Map Api Key Android

Please note, that this has shown you how to do it, for a debug version. Create a new Fingerprint, against your production Keystore, before you deploy this to the PlayStore.