Mad Final Project
Mad Final Project
A MICRO-PROJECT REPORT ON
This is to certify that the Micro-project entitled “GOOGLE MAP INTEGRATION” being submitted
herewith for the award of DIPLOMA IN ENGINEERING & TECHNOLOGY in Computer Engineering
Of Maharashtra State Board & Technical Education (MSBTE) is the result of Microproject work
completed under my supervision and guidance by Mr.P.T.Zhunjare
Place : Ambad
Date :
We, the undersigned, hereby declare that the project entitled “GOOGLE MAP INTEGRATION”
is written and submitted by us to Government Polytechnic Ambad during Year 2023-24, Sixth
Semester for partial fulfillment of the ‘Micro Project’ requirement of ‘Mobile Application
Develoapment ’ subject under Maharashtra State Board of Technical Education, Mumbai
curriculum, under the guidance of Mr.P.T.Zhunjare
Yours Sincerely,
activity_my_location.xml
<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout
xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:map="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
tools:context=".MyLocationActivity" >
<fragment android:id="@+id/map"
android:name="com.google.android.gms.maps.SupportMapFragment"
android:layout_width="match_parent"
android:layout_height="match_parent"/>
<LinearLayout android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="horizontal"
android:layout_alignParentBottom="true">
<Button android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:id="@+id/btn_my_location_normal"
android:text="Normal"
android:textSize="12sp"
android:textColor="@color/white"
android:textStyle="bold"
android:backgroundTint="@color/skyblue"/>
<Button android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:id="@+id/btn_my_location_satellite"
android:text="Satellite" android:textStyle="bold"
android:textSize="12sp"
android:textColor="@color/white"
android:backgroundTint="@color/skyblue"/>
<Button
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:id="@+id/btn_my_location_terrain"
android:text="Terrain" android:textSize="12sp"
android:textColor="@color/white"
android:textStyle="bold"
android:backgroundTint="@color/skyblue"/>
<Button android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:id="@+id/btn_my_location_hybride"
android:text="Hybride"
android:textSize="12sp"
android:textColor="@color/white"
android:textStyle="bold"
android:backgroundTint="@color/skyblue"/>
</LinearLayout>
</RelativeLayout>
MyLocationActivity.java
package com.example.apk;
import androidx.fragment.app.FragmentActivity;
import android.graphics.Color; import
android.os.Bundle; import android.view.View;
import android.widget.Button;
import com.google.android.gms.maps.CameraUpdateFactory; import
com.google.android.gms.maps.GoogleMap; import
com.google.android.gms.maps.OnMapReadyCallback; import
com.google.android.gms.maps.SupportMapFragment; import
com.google.android.gms.maps.model.CircleOptions; import
com.google.android.gms.maps.model.LatLng; import
com.google.android.gms.maps.model.MarkerOptions; import
com.example.apk.databinding.ActivityMyLocationBinding; import
com.google.android.gms.maps.model.PolygonOptions; import
com.google.android.gms.maps.model.PolylineOptions; public class
MyLocationActivity extends FragmentActivity implements
OnMapReadyCallback { private GoogleMap mMap;
private ActivityMyLocationBinding binding;
Button btn_satellite,btn_terrine,btn_hybride,btn_normal;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
binding = ActivityMyLocationBinding.inflate(getLayoutInflater());
setContentView(binding.getRoot()); btn_satellite =
findViewById(R.id.btn_my_location_satellite); btn_terrine =
findViewById(R.id.btn_my_location_terrain); btn_hybride =
findViewById(R.id.btn_my_location_hybride); btn_normal =
findViewById(R.id.btn_my_location_normal); // Obtain the
SupportMapFragment and get notified when the map is ready to be
used.
SupportMapFragment mapFragment = (SupportMapFragment)
getSupportFragmentManager() .findFragmentById(R.id.map);
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;
// Add a marker in Sydney and move the camera LatLng
mylocation = new LatLng(19.868721, 76.004675);
mMap.addMarker(new MarkerOptions().position(mylocation).title("Marker
in Pirkalyan"));
mMap.animateCamera(CameraUpdateFactory.newLatLngZoom(mylocation, 16),
5000, null);
mMap.addCircle(new CircleOptions()
.center(mylocation)
.radius(100)
.strokeColor(getColor(R.color.red))
.fillColor(Color.parseColor("#972B4283"))
);
btn_satellite.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
mMap.setMapType(GoogleMap.MAP_TYPE_SATELLITE);
}
});
btn_terrine.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
mMap.setMapType(GoogleMap.MAP_TYPE_TERRAIN);
}
});
btn_hybride.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
mMap.setMapType(GoogleMap.MAP_TYPE_HYBRID);
}
});
btn_normal.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
mMap.setMapType(GoogleMap.MAP_TYPE_NORMAL);
}
});
LatLng gpambad = new LatLng(19.617648, 75.780000);
mMap.addMarker(new MarkerOptions().position(gpambad).title("Marker on
Government Polytechnic ,Ambad")); mMap.addPolyline(new
PolylineOptions()
.add(mylocation,gpambad)
.width(10)
.color(getColor(R.color.red))
.geodesic(true));
}
}
AndroidMinifest.xml
https://www.android.com/intl/en_in/
https://www.google.com/android/find https://twitter.com/Android
https://www.youtube.com/channel/UC9M7-jzdU8CVrQo1JwmIdWA
Conclusion: