xamarin google map not working

xamarin forms maps
xamarin forms google maps navigation
xamarin android google map not showing
xamarin.forms.maps api key
google maps api key not working android
xamarin ios google maps
xamarin forms maps current location
android get api key from manifest

I created a map using the following link http://developer.xamarin.com/guides/android/platform_features/maps_and_location/maps/part_2_-_maps_api/ i followed all the procedures mentioned in it but what am getting is a blank screen. My application Output shows the following log on executing the map activity.

Open Connection [REQUEST] DRD(41): 62|147 [REQUEST] Close [REQUEST] Error processing: com.google.maps.api.android.lib6.b.d@42a1cef8 not retrying [REQUEST] Retrying: com.google.maps.api.android.lib6.c.au@429ced70

Can anyone please tell me why this is happening.

As @Miha mentioned this is keys related.

At present you will not be getting any map tiles displayed on the map.

To get the example to work there are several things that you need to do.

1) Obtain your Signing Key Fingerprint (SHA1) for your machine.

If you haven't already created your SHA1 key for your machine you will need to do this first. The link here describes how to generate this using the command console.

You will get a SHA1 key fingerprint as a result of this.

2) Obtain the package name from the project you are working on.

This can be located by looking at the Android project properties under the Android Manifest tab. You will then see a text-box for the Package name field.

3) In Google Developer Console you will need to create an Application should you not already have one, and Create A New Android key (This is located under APIs & auth \ Credentials).

On the screen that will pop-up you will be able to enter in the SHA1 key and Package Name that you have previously captured in the format {SHA1};{Package Name}.

This will then return to you the API key that you will use in the next step:-

4) In the Android Project, look at the source for AndroidManifest.xml. You will see the following:-

<meta-data android:name="com.google.android.maps.v2.API_KEY" android:value="{some api key}" />      

Enter you API key in that you have previously captured.

5) In the Google Developer Console, for the project, you also have to remember that you have to enable Google Maps Android API v2 and also Google Play Android Developer API. You can find these under APIs & auth \ APIs

You should then, finally, be able to run the demo.

Update 1:-

Add the uses-permission for MAPS_RECEIVE as @leoneboaventura mentioned also, so something like the following:-

<uses-permission android:name="{your-package-name}.permission.MAPS_RECEIVE" />

xamarin Google maps are not working, Make sure you have specified the google API key so the Map control can pick it up and do the API calls to Google services. You would need to follow google's  Xamarin.Forms - Working with Maps. 06/22/2020 +6; Browse code Download ZIP. The Map control displays a map, and requires the Xamarin.Forms.Maps NuGet package.

I just figured out what was wrong in my case. Probably because of Java naming rules, you have to name your package with the first letter in lowercase. Visual Studio names our packages following C# naming rules, which spells the first letters capitalized.

So, check if this issue isn't the same causing your map to don't open by doing the following:

1) Make sure your package name starts with small letter.

<manifest xmlns:android="http://schemas.android.com/apk/res/android" package="mypackage.android" android:versionCode="1" android:versionName="1.0">

Make sure your package is named mypackage.android not MyPackage.android.

2) Make sure your package name in the following two permissions matches the manifest package name spelling:

<uses-permission android:name="mypackage.android.permission.MAPS_RECEIVE" />
<permission android:name="mypackage.android.permission.MAPS_RECEIVE" android:protectionLevel="signature" />

3) Check if you APIKey is been generated to the same package name: {your SHA1 certificate fingerprint}:mypackage.android

Using the Google Maps API in Your Application, If it is not installed, then Google Maps will not work on the device. Install the Xamarin.GooglePlayServices.Maps package from NuGet. The  Especially, Bing Maps SDK is very old-fashioned because it has not vector-tile, marker's infowindow. Android and iOS monopolize most the mobile apps market. Thus I think no need Bing maps support. Furthermore, I am using Google Maps instead of MapKit because it is easy for define common API for Android and iOS. Xamarin.Forms.GoogleMaps provides

If you are unable to view the map after deploying a Release apk, follow this Video.. https://www.youtube.com/watch?v=xLJ0jDFdUZ0

As it says :

  1. Create a KeyStore from Visual Stuido.

a. Put project config mode to Release.

b. Clean and Build your Android project.

c. Right click your Android project and select Archive (Before that specify the version code and version name in your manifest or in properties).

d. Once the archive is completed, click on Distribute.

e. Select AdHoc channel.

f. Create a new Signing Identity with Alias, Password and other info.

g. This signing key creates a KeyStore file in location : C:\Users\[UserName]\AppData\Local\Xamarin\Mono for Android\Keystore\[Alias]\[Alias].keystore Note : [Alias] is the name you defined when creating the KeyStore file

  1. Open your cmd. cd to C:\Program Files\Java\jdk1.8.0_131\bin
  2. Execute : keytool -list -v -keystore "C:\Users\[UserName]\AppData\Local\Xamarin\Mono for Android\Keystore\[Alias]\[Alias].keystore" -alias [Alias]
  3. You will get the output with MD5, SHA1, SHA256... Copy the SHA1 key.

  4. Go to https://console.developers.google.com . Select your project you created for Android API key.

  5. Click on credentials and select your API key.
  6. Add new Package name and finger print with your project's package name and SHA1 key you copied. Note : Project's package name defined on Android Project's manifest and properties.

  7. Wait for like 5 mins to take the changes to affect. Afterwards you can again archive and get a new APK. Install on your android device and see. You will now be able to see the map.

NOTE :: I am referring to Xamarin, Visual Studio 2017

Map does not show up with latest version of Xamarin , No any log for google map api android. I downgrade googleplay services. Map working. Can fix this problem with new version  Xamarin.Forms Maps, allows you to display a map inside your Xamarin.Forms application. You can see a map of your current location, place pins on the map, and also provide a route between two locations. I have a sample repo at XamarinMaps, if you want to see a complete solution. Setup To setup your projects, first …

Map does not show on Android even with valid key · Issue #277 , I am running the sample application on android and have put my API key into "​Basic Map", this shows a Teal coloured grid with Xamarin.Forms. Find local businesses, view maps and get driving directions in Google Maps. When you have eliminated the JavaScript , whatever remains must be an empty page. Enable JavaScript to see Google Maps.

Dynamically set Google Maps API key in Xamarin forms, I'm sorry as I said API support is not provided in this peer to peer support forum. To use the Google Maps functionality in Android, you need to register for a Maps API key with Google. Until you do this, you will just see a blank grid instead of a map in your applications. You must obtain a Google Maps Android API v2 key - keys from the older Google Maps Android API key v1 will not work.

Controls and Gestures | Maps SDK for Android, In lite mode, users cannot pan or zoom the map and gestures do not work. For details, see the guide to lite mode. UI controls. The Maps API offers built-in UI  A <xref data-throw-if-not-resolved="true" uid="Xamarin.Forms.View"></xref> that shows a map provided by a platform-specific service.</p>

Comments
  • Usually it is a key issue. Did you enable access through google apis console? Using correct key? Etc. You might also get more info if you look at Log from your device (not just output window).
  • @MihaMarkic i enabled the access through google apis console and created the key from there itself.
  • Updated answer with extra info (See Update 1)
  • Usually package names in Android start with com. if you want to stick to traditional standards. Nice observation though.
  • One more thing in the step g. In visual studio you can just double click on the new generated Signing Identity abd you will find the SHA1