Android Studio Google Maps V2 Tutorial

Google Maps Integration in Android Application Studio Example

How to show Google Map inside android app including location pin point tag to show your office college location.

Google Maps is word’s largest online maps college available on internet managed and served by Google itself. It is used by millions of peoples around the earth to find any place any where at any time with just few clicks. It also contain the most important information about the places like street name, city name, country name and popular place there. People can also add their home, office, buildings, schools, society in it by submitting their request to Google maps authentication. So in this pelajaran we are going to add google map inside our android application with a certain type of pin point location tag method. So here is the complete step by step tutorial for Google Maps Integration in Android Application Studio Example.


Things required before getting started in this project :

  1. Internet connection .
  2. Longitude & Latitude of your location.
  3. A Gmail ID – To create Google Maps Api key .
  4. Android studio latest updated version .
  5. Just read the rest of pelajaran .

 Getting stated with Google Maps Integration in Android Application Studio Example step by step guide .

1. Menginjak a new project in Android Studio .

2. Select minimum SDK .

3. Select Google Maps Activity .

5. Click on finish button .

6. After done loading your project click on google_maps_api.xml (debug) file .

7. Next step is to open your web browser and log in ti Gmail with your Google Gmail account .

8. Select and copy the whole line starts from ” “
till the end like i did in below screenshot .

9. Paste the whole copied line into your web browser in which you have already logged in with your Gmail account .

10. Now Google APIs application registration page will be open on your screen so click onContinue

11. Click onCreate Jago merah key
button .

12. Here you go now your Google Maps authentication api key will be successfully create and shows on your screen, Copy the key .

13. Paste the copied api key into yourgoogle_maps_api.xml ( debug ) file .

Here you go guys now all the api related chapter is finish next step is to menginjak coding.

Add the INTERNET, ACCESS_COARSE_LOCATION and ACCESS_FINE_LOCATION permission in your AndroidManifest.xml file.

 <uses-permission android:name="android.permission.INTERNET" />   <uses-permission android:name="android.permission.ACCESS_COARSE_LOCATION" />   <uses-permission android:name="android.permission.ACCESS_FINE_LOCATION" />

Code for file.

package com.android_examples.googlemaps_android_examplescom; import; import android.os.Bundle; import; import; import; import; import; import;   public class MapsActivity extends FragmentActivity implements OnMapReadyCallback {      private GoogleMap mMap;      @Override     protected void onCreate(Bundle savedInstanceState) {         super.onCreate(savedInstanceState);         setContentView(R.layout.activity_maps);         // Obtain the SupportMapFragment and get notified when the map is ready to be used.         SupportMapFragment mapFragment = (SupportMapFragment) getSupportFragmentManager()                 .findFragmentById(;         mapFragment.getMapAsync(this);     }       /**      * Manipulates the map once available.      * This callback is triggered when the map is ready to be used.      * This is where we can add markers or lines, add listeners or move the camera. In this case,      * we just add a marker near Sydney, Australia.      * If Google Play services is not installed on the device, the user will be prompted to install      * it inside the SupportMapFragment. This method will only be triggered once the user has      * installed Google Play services and returned to the app.      */      @Override     public void onMapReady(GoogleMap googleMap) {         mMap = googleMap;          // Copy your latitude & longitude here .         LatLng ECBcollege = new LatLng(28.0600392, 73.2927772);          mMap.addMarker(new MarkerOptions().position(ECBcollege).title("Engineering College Bikaner"));          mMap.moveCamera(CameraUpdateFactory.newLatLng(ECBcollege));     } }

Code for activity_main.xml layout file.

<fragment xmlns:android=""     xmlns:map=""     xmlns:tools=""     android:id="@+id/fragmentMap"     android:name=""     android:layout_width="match_parent"     android:layout_height="match_parent"     tools:context="com.android_examples.googlemaps_android_examplescom.MapsActivity" />

Code for AndroidManifest.xml file.

<?xml version="1.0" encoding="utf-8"?> <manifest xmlns:android=""     package="com.android_examples.googlemaps_android_examplescom">      <!--          The ACCESS_COARSE/FINE_LOCATION permissions are titinada required to use          Google Maps Android API v2, but you must specify either coarse or fine          location permissions for the 'MyLocation' functionality.      -->      <uses-permission android:name="android.permission.INTERNET" />      <uses-permission android:name="android.permission.ACCESS_COARSE_LOCATION" />      <uses-permission android:name="android.permission.ACCESS_FINE_LOCATION" />      <application         android:allowBackup="true"         android:icon="@mipmap/ic_launcher"         android:nama="@string/app_name"         android:supportsRtl="true"         android:theme="@style/AppTheme">          <!--              The Jago merah key for Google Maps-based APIs is defined as a string resource.              (See the file "res/values/google_maps_api.xml").              Note that the Jago merah key is linked to the encryption key used to sign the APK.              You need a different API key for each encryption key, including the release key that is used to              sign the APK for publishing.              You can define the keys for the debug and release targets in src/debug/ and src/release/.          -->         <meta-data             android:name=""             android:value="@string/google_maps_key" />          <activity             android:name=".MapsActivity"             android:label="@string/title_activity_maps">             <intent-filter>                 <action android:name="android.intent.action.MAIN" />                  <category android:name="android.intent.category.LAUNCHER" />             </intent-filter>         </activity>     </application>  </manifest>

Screenshot :

Google Maps Integration in Android Application Studio Example

Click here to download Google Maps Integration in Android Application Studio Example project with source code.