Introduction

We can use Google Maps in our Android application using some APIs and libraries. Google provides its maps application for use by us in any Android app and we can modify it depending on our requirements.
First, create an Android Activity Project on Eclipse. For that, go to File, then New and select Android Application Project.
android application progract
Next:
type application name
Set the SDK depending on your app, then click Next:
Set SDK
Next:
click next
Next, set the Icon of the Android Application.
activity name
Finished.
Then import Google Play services from the SDK.
Location: <sdk>extras\Google \Google _play_services\libproject\Google -play-services_lib </sdk>
Right-click on the project and select Import.
Import
Next
reboot directory
Click on Finish. I’ve already Imported the Google Play library. Therefore the Finish button is not shown as Enabled.
If you do not find the Google Play service library then open the Android SDK Manager and download it as in the following:
Google play service
After download, add the Google Play service to your project:
android
Select Google -play-service_lib and OK.
clock ok
Click on Apply, then Ok.
apply
Open the activity_main.xml file.
xml
Then drag the Fragment layout into the app screen.
A popup screen will show.
Select MapFragment and then OK.
Go to the activity_main.xml code part and change the property of width and height and replace “wrap_content” with “fill_parent”.
This is for showing the full-screen map.
Open the AndroidManifest.xml code file and paste the code above the <application> tag:
  1. <uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" />
  2. <uses-permission android:name="android.permission.INTERNET" />
  3. <uses-permission android:name="com.Google .android.providers.gsf.permission.READ_GSERVICES" />
  4. <uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" />
  5. <uses-permission android:name="android.permission.ACCESS_COARSE_LOCATION" />
  6. <uses-permission android:name="android.permission.ACCESS_FINE_LOCATION" />
  7. <uses-permission android:name="android.permission.READ_EXTERNAL_STORAGE" />
  8. <uses-permission android:name="com.example.goglemap.permission.MAPS_RECEIVE" />
  9. <permission
  10. android:name="com.example.Google map.MAPS_RECEIVE"
  11. android:protectionLevel="signature" />
It is shown in the following figure:
program code
Then go to the Window tab, then Preferences and select the Android menu. Then click Build.
Build
Copy SHA1 fingerprint:
And go to the website.
Create the project, then provide the name of the project.
Create Project
You can decide any name depending on your choice.
After clicking on the project then go to the APIs submenu.
APIs
Choose Google Maps Android API.
Google Maps Android AP
Enable Google Maps Android API v2.
Enable Google Maps Android API
Go to the Credentials submenu.
Credentials
Click on first Create new Key, then a pop-up screen will be visible. Now choose Android Key.
create new key
Copy the SHA1 Fingerprint in the text area and add a “;” (semicolon) and provide your project's package name.
SHA1 Fingerprint
Click on Create and Copy API Key.
API Key
Then process again go to the AndroidManifest.xml code file and add the following code between the <Activity> tags.
  1. <meta-data
  2. android:name="com.Google .android.gms.version"
  3. android:value="@integer/Google _play_services_version"/>
  4. <meta-data
  5. android:name="com.Google .android.maps.v2.API_KEY"
  6. android:value="API_KEY"/>
Like the following figure:
code
Paste your Client Key into the value of Android android:value="API_KEY", then open MainActivity.java and import the following two classes:
  1. import com.Google .android.gms.maps.Google Map;
  2. import com.Google .android.gms.maps.MapFragment;
Write the following code in the onCreate() method:
  1. MapFragment mf=(MapFragment)getFragmentManager().findFragmentById(R.id.fragment1);
  2. Google Map mp=(Google Map)mf.getMap();
  3. mp.setMapType(Google Map.MAP_TYPE_SATELLITE);
code in onCreate Method
Then run your project for the first time in AVD to build the .apk file, then move it into Android and install it.