Programming, Xamarin.Forms, Xamarin.Forms.Android

Obtaining a Google Maps API Key

I recently observed an issue when debugging my Xamarin.Forms.Android solution which uses Xamarin.FormsMaps in two different development environments.

The problem was, that I received an error stating that I was missing authentication with the Google Maps API in only one development environment.

Solving the issue

This guide assumes that you have already succesfully established a connection with the Google Maps API in at least one development environment. If you havn’t already worked with Xamarin.FormsMaps before, here is a guide on how to get started, and here is a detailed list of the required permissions in your Android project.

Anywho, on to the issue at hand:

  1. First, obtain the SHA1 fingerprint from your debug key by following this guide
    1. While you’re at it, grab the SHA1 fingerprint for your release key as well by following the same process, but by select the certificate you use for release
  2. Open the Google Developers Console
  3. Select your project and navigate to “APIs & auth” => “Credentials”
  4. In here, click “Edit allowed Android applications”
  5. For each key you have (I’ve got 3 in total: 2 development enviroments, and 1 release certifcate) add a new line with the following contents:
    1. <SHA1-fingerprint>;com.your.packagename
  6. Click “Update”

By now, your “Key for Android applications” should resemble that of the screenshot below. If it does, the Google Maps API has been succesfully registered with both your development and release certficates.

Android SHA1 Fingerprints

Android SHA1 Fingerprints

// Dave

Standard

Leave a Reply