unit 6 my notes
unit 6 my notes
🔹 Reverse Geocoding
Reverse Geocoding is the opposite. It converts latitude and longitude into a human-
readable address (like "MG Road, Bengaluru").
It is useful when an app gets GPS location from the device and needs to show the
current address to the user.
🔹 How It Works in Android (Code Example):
Java
Geocoder geocoder = new Geocoder(context);
List<Address> addresses = geocoder.getFromLocation(lat, lng, 1);
This returns a list of Address objects containing street, city, country, etc.
🔹 Uses in Mobile Apps:
Maps and Navigation
Cab services (Uber, Ola)
Food Delivery (Swiggy, Zomato)
Weather apps
Location tagging in social media
Key Points (For Revision):
Geocoding → Address to Coordinates
Reverse Geocoding → Coordinates to Address
Done using Geocoder class in Android
Essential in location-aware mobile apps
✅ 5. Steps to Create Signed APK for Android AppSteps:
1. Open Android Studio
o Open your completed Android project.
2. Go to Build > Generate Signed Bundle / APK
o Choose APK, then click Next.
3. Create or Use Keystore
o A keystore contains your app’s digital signature.
o If you don’t have one, create a new keystore file.
4. Enter Keystore and Key Details
o Provide:
Key alias
Key password
Keystore password
Path to keystore file
5. Select Build Type
o Choose Release for production (Play Store).
o Click Next.
6. Choose Destination Folder
o Select the folder where you want the APK file to be saved.
7. Click Finish
o Android Studio will generate the signed APK in the selected folder.
✅ 11. Develop Android Application for the Following Operations on Google Map
Operations:
1. Show Map
2. Zoom and Navigate
3. Get Current Location
🔹 1. Display Map
Use a MapFragment in your layout to show the map.
In activity_maps.xml:
xml
<fragment
android:id="@+id/map"
android:name="com.google.android.gms.maps.SupportMapFragment"
android:layout_width="match_parent"
android:layout_height="match_parent" />
🔹 2. Zoom and Navigation
When the map is ready, set zoom level and move camera to a location.
Example in onMapReady():
java
LatLng delhi = new LatLng(28.6139, 77.2090); // Example: Delhi
googleMap.moveCamera(CameraUpdateFactory.newLatLngZoom(delhi, 15));
🔹 3. Get Current Location
Use GPS to get user location.
Add permissions in AndroidManifest.xml:
xml
<uses-permission android:name="android.permission.ACCESS_FINE_LOCATION" />
java
FusedLocationProviderClient fusedLocationClient =
LocationServices.getFusedLocationProviderClient(this);
fusedLocationClient.getLastLocation().addOnSuccessListener(location -> {
if (location != null) {
LatLng myLocation = new LatLng(location.getLatitude(), location.getLongitude());
googleMap.addMarker(new MarkerOptions().position(myLocation).title("You are
here"));
googleMap.moveCamera(CameraUpdateFactory.newLatLngZoom(myLocation, 16));
}
});
An app must request permissions from the user to use these features.
🔹 Types of Permissions:
1. Normal Permissions
o These have low risk.
o Automatically granted during installation.
o Example:
Access to internet
Set wallpaper
Check network state
2. Dangerous Permissions
o These involve user’s private data.
o Must be granted by the user at runtime (after Android 6.0).
o Example:
Access location
Read contacts
Use camera
Send SMS
In AndroidManifest.xml file:
xml
Java
if (ContextCompat.checkSelfPermission(this, Manifest.permission.CAMERA)
!= PackageManager.PERMISSION_GRANTED) {
ActivityCompat.requestPermissions(this,
}
✅ Examples of Common Permissions:
PERMISSION PURPOSE
INTERNET For using internet
ACCESS_FINE_LOCATION For getting GPS location
CAMERA To use device camera
READ_CONTACTS To access contact list
SEND_SMS To send SMS from the app
READ_EXTERNAL_STORAGE To read files from storage
🔸 What is it?
To allow only trusted apps to access specific parts (like services or activities) of your app.
🔹 How to define:
In AndroidManifest.xml:
xml
<permission
android:name="com.example.MY_PERMISSION"
android:protectionLevel="dangerous" />
🔹 How to use:
Apply it to an activity/service:
xml
<service android:name=".MyService"
android:permission="com.example.MY_PERMISSION" />
Xml
<uses-permission android:name="com.example.MY_PERMISSION" />
✅ Summary:
1. Create Developer Account – Register on Google Play Console (one-time $25 fee).
2. Develop & Test App – Make sure the app works properly.
3. Create Signed APK/AAB – Sign your app for release.
4. Prepare Store Listing – Add app name, icon, screenshots, description.
5. Set Rating & Price – Choose content rating and make it free or paid.
6. Upload App – Submit APK/AAB on Play Console.
7. Publish – After review, your app goes live.