0% found this document useful (0 votes)
9 views3 pages

MAD31

The document contains an AndroidManifest.xml file that defines the application settings, including metadata for Google Maps API and two activities: MapsActivity and MainActivity. The MapsActivity.java file implements a map feature using Google Maps, displaying a marker in Taloja, India. The application supports backup and has a specified theme and icon.

Uploaded by

sahilmirza.it
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
9 views3 pages

MAD31

The document contains an AndroidManifest.xml file that defines the application settings, including metadata for Google Maps API and two activities: MapsActivity and MainActivity. The MapsActivity.java file implements a map feature using Google Maps, displaying a marker in Taloja, India. The application supports backup and has a specified theme and icon.

Uploaded by

sahilmirza.it
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 3

AndoridManifest.

xml

<?xml version="1.0" encoding="utf-8"?>


<manifest xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools">

<application
android:allowBackup="true"
android:dataExtractionRules="@xml/data_extraction_rules"
android:fullBackupContent="@xml/backup_rules"
android:icon="@mipmap/ic_launcher"
android:label="@string/app_name"
android:roundIcon="@mipmap/ic_launcher_round"
android:supportsRtl="true"
android:theme="@style/Theme.PR31"
tools:targetApi="31">

<meta-data
android:name="com.google.android.geo.API_KEY"
android:value="AIzaSyCrl2zZdyLCWdz2noTfi3a0Yc_6RCOCeRM" />

<activity
android:name=".MapsActivity"
android:exported="true"
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>
<activity
android:name=".MainActivity"
android:exported="true">
<intent-filter>
<action android:name="android.intent.action.MAIN" />

<category android:name="android.intent.category.LAUNCHER" />


</intent-filter>
</activity>
</application>

</manifest>
MapsActivity.java
package com.example.pr31;

import androidx.fragment.app.FragmentActivity;

import android.os.Bundle;

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.LatLng;
import com.google.android.gms.maps.model.MarkerOptions;
import com.example.pr31.databinding.ActivityMapsBinding;

public class MapsActivity extends FragmentActivity implements OnMapReadyCallback {

private GoogleMap mMap;


private ActivityMapsBinding binding;

@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);

binding = ActivityMapsBinding.inflate(getLayoutInflater());
setContentView(binding.getRoot());

// 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);
}
@Override
public void onMapReady(GoogleMap googleMap) {
mMap = googleMap;

// Add a marker in Sydney and move the camera


LatLng sydney = new LatLng(19.07019494257574, 73.09735946479509);
mMap.addMarker(new MarkerOptions().position(sydney).title("Marker in Taloja"));
mMap.moveCamera(CameraUpdateFactory.newLatLng(sydney));
}
}

You might also like