Xamarin.forms.googlemaps: Map does not show on Android even with valid key

Created on 12 Apr 2017  路  6Comments  路  Source: amay077/Xamarin.Forms.GoogleMaps

I am running the sample application on android and have put my API key into the Variables.cs for Android. I then run the sample application and click "Basic Map", this shows a Teal coloured grid with Xamarin.Forms.GoogleMaps text in the middle

PLATFORMS

  • [x] Android
  • [ ] iOS
  • [ ] UWP

Most helpful comment

I had a similar issue today. I debugged it while checking
if (GooglePlayServicesUtil.IsGooglePlayServicesAvailable(Context) == ConnectionResult.Success) in MainActivity and it returned ServiceVersionUpdateRequired, which lead me to the fact that google play services needed update on the device (it was really old).

I would bet you have the same problem :)

All 6 comments

You should call Xamarin.FormsGoogleMaps.Init in MainActivity.cs, please check it.

https://github.com/amay077/Xamarin.Forms.GoogleMaps/blob/master/XFGoogleMapSample/Droid/MainActivity.cs#L24

@amay077 I am also calling Xamarin.FormsGoogleMaps.Init() in MainActivity.cs.
I have tested on the sample and on my own application. I was wondering if anything had Changed?

To generate my key I followed Step 1 and 2 from here: https://developers.google.com/maps/documentation/android-api/signup

Hmm.. Very strange.

Running the sample application I put the following in MainActivity:

        global::Xamarin.Forms.Forms.Init(this, bundle);
        Xamarin.FormsGoogleMaps.Init(this, bundle); // initialize for Xamarin.Forms.GoogleMaps
        var d = Xamarin.FormsGoogleMaps.IsInitialized;

I put a break point to check the value of d and d= false. This is using 1.8.0-Beta7.

Could initialisation be broken?

I had a similar issue today. I debugged it while checking
if (GooglePlayServicesUtil.IsGooglePlayServicesAvailable(Context) == ConnectionResult.Success) in MainActivity and it returned ServiceVersionUpdateRequired, which lead me to the fact that google play services needed update on the device (it was really old).

I would bet you have the same problem :)

@raver999 Thanks! that was the problem. I had to update Google Play Services on the phone

Was this page helpful?
0 / 5 - 0 ratings

Related issues

talhaa91 picture talhaa91  路  4Comments

kitkat14 picture kitkat14  路  3Comments

non335 picture non335  路  7Comments

mtsrdr picture mtsrdr  路  6Comments

prajithmp picture prajithmp  路  6Comments