When our mobile app development team started working with Google Maps on Xamarin, we found that there were a lot of conflicting methods of initializing a map view for Android using Xamarin. Here is a step-by-step breakdown of what needs to be done to add Google Maps to your Android Xamarin application.

1. Update your Properties/AndroidManifest.xml file.

<uses-sdk android:minSdkVersion="14" android:targetSdkVersion="17" />

<!– Google Maps for Android v2 requires OpenGL ES v2 –>
<uses-feature android:glEsVersion=”0x00020000″ android:required=”true” />

<!– We need to be able to download map tiles and access Google Play Services–>
<uses-permission android:name=”android.permission.INTERNET” />

<!– Allow the application to access Google web-based services. –>
<uses-permission android:name=”com.google.android.providers.gsf.permission.READ_GSERVICES” />

<!– Google Maps for Android v2 will cache map tiles on external storage –>
<uses-permission android:name=”android.permission.WRITE_EXTERNAL_STORAGE” />

<!– Google Maps for Android v2 needs this permission so that it may check the connection state as it must download data –>
<uses-permission android:name=”android.permission.ACCESS_NETWORK_STATE” />

<!– These are optional, but recommended. They will allow Maps to use the My Location provider. –>
<uses-permission android:name=”android.permission.ACCESS_COARSE_LOCATION” />
<uses-permission android:name=”android.permission.ACCESS_FINE_LOCATION” />

<application android:label=”MapTracker” android:icon=”@drawable/Icon”>
<!– Put your Google Maps V2 API Key here. –>
<meta-data android:name=”com.google.android.maps.v2.API_KEY” android:value=”get_an_api_key” />
<meta-data android:name=”com.google.android.gms.version” android:value=”@integer/google_play_services_version” />

This configuration first sets up the permission requests you will need to make to use Google Maps. First, change the uses-sdk attributes to set whatever minimum and maximum SDKs you plan to target. After that, you will need to get a Google Maps V2 API key [https://developers.google.com/maps/documentation/android/start#obtain_a_google_maps_api_key].

2. Add a map fragment to your activity’s .axml file.

Google Maps will need to use a fragment element to render. So, we will need to add this fragment using the following code:
<fragment xmlns:android="http://schemas.android.com/apk/res/android"
class="com.google.android.gms.maps.MapFragment" />

This will add the blank fragment to your activity.

3. Initialize the Google Map object using the fragment.

I added the following properties to my activity:

private GoogleMap Map { get; set; }
private MapFragment MapFragment { get; set; }

I then created the following functions and overrides:

protected override void OnResume() {

private void IntializeGoogleMap() {
if (this.MapFragment != null) return;

this.MapFragment = (MapFragment)FragmentManager.FindFragmentById(Resource.Id.map);
this.Map = this.MapFragment.Map;

if (this.Map == null) return;

this.Map.MapLongClick += HandleLongClick;

this.CreateMarker(“Acumen Consulting”, new LatLng(38.626845, -90.340147));


void HandleLongClick(object sender, GoogleMap.MapLongClickEventArgs e) {

private void CreateMarker(string name, LatLng location) {
var marker = new MarkerOptions();

protected void CreateMarkerDialog(LatLng location) {
var alert = new AlertDialog.Builder(this);


// Set an EditText view to get user input
var input = new EditText(this);

alert.SetPositiveButton(“Create”, (sender, args) => {
this.CreateMarker(input.Text, location);
alert.SetNegativeButton(“Cancel”, (IDialogInterfaceOnClickListener)null);
private LatLng GetCurrentLocation() {
var service = (LocationManager)GetSystemService(LocationService);
var criteria = new Criteria();
var provider = service.GetBestProvider(criteria, false);
var location = service.GetLastKnownLocation(provider);
return (location != null) ? new LatLng(location.Latitude, location.Longitude) : new LatLng(50, 3);

OnResume gets called whenever the user opens or returns to the app. This fires off the initialization for the Google Map (InitializeGoogleMap()). This should load the map in the application.

In InitializeGoogleMap(), you will see I added a couple other methods of mine to help you out. MapLongClick is when the user taps and holds on a location. This lets the user create a marker of their own on the map, giving them alert to ask for the title of the location. CreateMarker() allows you to cleanly create a new marker on the map by passing a title and coordinate. UpdateLocation() is also a wrapper function that allows you to pass a LatLng and update the map camera to that spot. You will see that it currently passes the value of GetCurrentLocation(), which uses the LocationManager to get the location of the user when they resumed the app.

I hope this helps you get started with using Google Maps on the Xamarin Android platform. If you have any questions, feel free to comment below!

Are you looking for Android Development services? Check out our Android Phone development page and contact us! Or, if you are looking for cross-platform solutions, we are also Xamarin Development experts.