Launching The Google Maps Activity Using Xamarin Android Application


Xamarin is a development platform, which allows us to code native, cross-platform iOS, Android and Windows Phone apps in C#. This tutorial focus on Xamarin Android Intent Action to launch the Phone Dialer.


  • Visual Studio RC 2017
  • Xamarin Studio Packages

Follow the steps

Please follow my steps to create launching Google Maps and use this tutorial effectively. An intent is an abstract description of an operation to be performed.

Step 1

Launch Visual Studio RC 2017 and go to file-> new project.

Step 2

Now, there is need to select the Android template from the list, name the Application, press to create the Project and select, where to save the project.


Step 3

Here, we go to our new project, which has been created and then we need to navigate to Designer Page. To open the designer page, you need to open Solution Explorer ViewàSolution Explorer.


Step 4

Now, open Designer Page. There is a need to select the Solution ExploreràResourcesàLayoutàMain.Xaml given below.


Step 5

Add the code given below in Main.Xaml Source page. This main.xaml file is our designer page and here, our Intent Action will be present here.

  1. <?xml version="1.0" encoding="utf-8"?>  
  2. <LinearLayout xmlns:android=""  
  3.    android:orientation="vertical"  
  4.    android:layout_width="match_parent"  
  5.    android:layout_height="match_parent">  
  6. <Button  
  7.    android:id="@+id/MyButton"  
  8.    android:layout_width="match_parent"  
  9.    android:layout_height="wrap_content"  
  10.    android:text="Open the Map" />  
  11. </LinearLayout>   

Step 6

Add the code given below in MainActivity.cs. This main acitivity plays most important role and this makes our app to work correctly and customizing the buttons with the background activity.

  1. using System;  
  2. using Android.App;  
  3. using Android.Content;  
  4. using Android.Runtime;  
  5. using Android.Views;  
  6. using Android.Widget;  
  7. using Android.OS;  
  8. namespace IntentAction {  
  9.     [Activity(Label = "IntentAction", MainLauncher = true, Icon = "@drawable/icon")]  
  10.     public class MainActivity: Activity {  
  11.         protected override void OnCreate(Bundle bundle) {  
  12.             base.OnCreate(bundle);  
  13.             // Set our view from the "main" layout resource  
  14.             SetContentView(Resource.Layout.Main);  
  15.             // Get our button from the layout resource,  
  16.             // and attach an event to it  
  17.             Button button = FindViewById < Button > (Resource.Id.MyButton);  
  18.             button.Click += delegate {  
  19.                 var geoUri = Android.Net.Uri.Parse("geo:42.37426660,-71.12420824");  
  20.                 var mapIntent = new Intent(Intent.ActionView, geoUri);  
  21.                 StartActivity(mapIntent);  
  22.             };  
  23.         }  
  24.     }  
  25. }   

Launch the phone dialer.



Thank you for reading. Please make use of this blog. If you have any doubt or query, comment below. If you like it, follow me for more updates about Xamarin Android app development.