0% found this document useful (0 votes)
4 views

Unit 6

The document outlines various aspects of Android development, including syntax for displaying zoom controls in Google Maps, steps to deploy an app on the Google Play Store, methods for geocoding, and features of the Google Play Developer Console. It also includes code examples for sending and receiving SMS, displaying Google Maps with user location, and explains the Android security model and permission types. Additionally, it details the APK building process and methods to obtain location data in Android.

Uploaded by

ombhaltilak2006
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)
4 views

Unit 6

The document outlines various aspects of Android development, including syntax for displaying zoom controls in Google Maps, steps to deploy an app on the Google Play Store, methods for geocoding, and features of the Google Play Developer Console. It also includes code examples for sending and receiving SMS, displaying Google Maps with user location, and explains the Android security model and permission types. Additionally, it details the APK building process and methods to obtain location data in Android.

Uploaded by

ombhaltilak2006
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/ 31

Unit 6

Summer 2022

1. State syntax to display built in zoom control. (2marks)

Ans.

Built in Zoom control in Google map can be displayed with :

UiSettings.setZoomControlsEnabled(true);

2. List and elaborate steps to deploy an Android application on Google play store. (4marks)

Ans.

Steps to deploy and Android Application on Google Play Store:

Step 1: Make a Developer Account

Step 2: Plan to Sell? Link Your Merchant Account

Step 3: Create an App

Step 4: Prepare Store Listing

Step 5: Upload APK to an App Release

Step 6: Provide an Appropriate Content Rating

Step 7: Set Up Pricing & Distribution

Step 8: Rollout Release to Publish Your App

Step 1: Create a Developer Account

Before you can publish any app on Google Play, you need to create a Developer Account. You can easily
sign up for one using your existing Google Account. You’ll need to pay a one-time registration fee of $25
using your international credit or debit card. It can take up to 48 hours for your registration to be fully
processed.

Step 2: Plan to Sell? Link Your Merchant Account

If you want to publish a paid app or plan to sell in-app purchases, you need to create a payments center
profile, i.e. a merchant account. A merchant account will let you manage your app sales and monthly
payouts, as well as analyze your sales reports right in your Play Console.
Step 3: Create an App

Now you have create an application by clicking on 'Create Application'. Here you have to select your
app’s default language from the drop-down menu and then type in a title for your app. The title of your
app will show on Google Play after you’ve published.

Step 4: Prepare Store Listing

Before you can publish your app, you need to prepare its store listing. These are all the details that will
show up to customers on your app’s listing on Google Play. You not necessarily complete it at once , you
can always save a draft and revisit it later when you’re ready to publish.

The information required for your store listing is divided into several categories such as Product Details
containing title, short and full description of the app, Your app’s title and description should be written
with a great user experience in mind. Use the right keywords, but don’t overdo it. Make sure your app
doesn’t come across as spam-y or promotional, or it will risk getting suspended on the Play Store. Graphic
Assets where you can add screenshots, images, videos, promotional graphics, and icons that showcase
your app’s features and functionality. Languages & Translations, Categorization where in category can be
selected to which your app belong to. Contact Details , Privacy Policy for apps that request access to
sensitive user data or permissions, you need to enter a comprehensive privacy policy that effectively
discloses how your app collects, uses, and shares that data.

Step 5: Upload APK to an App Release

Finally upload your app, by uploading APK file. Before you upload APK, you need to create an app release.
You need to select the type of release you want to upload your first app version to. You can choose
between an internal test, a closed test, an open test, and a production release. The first three releases
allow you to test out your app among a select group of users before you make it go live for everyone to
access.

This is a safer option because you can analyze the test results and optimize or fix your app accordingly if
you need to before rolling it out to all users.

Once you create a production release, your uploaded app version will become accessible to everyone in
the countries you choose to distribute it in and click on ‘Create release.’

Step 6: Provide an Appropriate Content Rating

If you don’t assign a rating to your app, it will be listed as ‘Unrated’. Apps that are ‘Unrated’ may get
removed from Google Play.
To rate your app, you need to fill out a content rating questionnaire An appropriate content rating will
also help you get to the right audience, which will eventually improve your engagement rates.

Step 7: Set Up Pricing & Distribution

Before you can fill out the details required in this step, you need to determine your app’s monetization
strategy. Once you know how your app is going to make money, you can go ahead and set up your app as
free or paid. You can always change your app from paid to free later, but you cannot change a free apto
paid. For that, you’ll need to create a new app and set its price.

Step 8: Rollout Release to Publish Your App

The final step involves reviewing and rolling out your release after making sure you’ve taken care of
everything else.

Before you review and rollout your release, make sure the store listing, content rating, and pricing and
distribution sections of your app each have a green check mark next to them.

Once you’re sure about the correctness of the details, select your app and navigate to ‘Release
management’ – ‘App releases.’ You can always opt for reviews by clicking on ‘Review’ to be taken to the
‘Review and rollout release’ screen. Here, you can see if there are any issues or warnings you might have
missed out on. Finally, select ‘Confirm rollout.’ This will also publish your app to all users in your target
countries on Google Play.

3. State and elaborate the syntax of required class and methods for Geocoding. (4marks)

Ans.

• Geocoding is the process of converting an address (or place name) into latitude and longitude
coordinates.

• It helps find the exact geographical location of a place.

• Example:

Input: "Taj Mahal, Agra, India"

Output: Latitude: 27.1751, Longitude: 78.0421

Methods with Syntax

a. getFromLocation

Syntax

public List<Address> getFromLocation (double latitude, double longitude, int maxResults)


public void getFromLocation (double latitude, double longitude, int maxResults,
Geocoder.GeocodeListener listener)

This method returns an array of Addresses that attempt to describe the area immediately surrounding
the given latitude and longitude. The returned addresses should be localized for the locale provided to
this class's constructor.

b. getFromLocationName

Syntax :

● public void getFromLocationName (String locationName, int maxResults, Geocoder.GeocodeListener


listener)

● public List<Address> getFromLocationName (String locationName, int maxResults)

Returns an array of Addresses that attempt to describe the named location, which may be a place name
such as "Dalvik, Iceland", an address such as "1600 Amphitheatre Parkway, Mountain View, CA", an
airport code such as "SFO", and so forth. The returned addresses should be localized for the locale
provided to this class's constructor.

4. Discuss developer console with at least four features. (4marks)

Ans.

● Google Play Developer Console is the platform that Google provides for Google Play and Android
developers to publish their apps.

● The Google Play Developer console allows app developers and marketers to better understand how
their apps are performing in terms of growth, technical

performance such as crashes or display issues, and financials.

● The console offers acquisition reports and detailed analysis which can help app devs find out how well
an app is really performing.

● The platform is important as it provides developers with access to first party data (trustworthy
information collected about an app’s audience that comes straight from Google Play) that highlights the
real performance of an app.

● It shows the number of impressions an app listing receives and the number of Installs an app receives
from different sources over time.

5. Write a program to demonstrate declaring and using permissions with any relevant example.
(4marks)
Ans.

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

<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"

android:layout_width="match_parent"

android:layout_height="match_parent"

android:orientation="vertical"

android:padding="16dp">

<EditText

android:id="@+id/e1"

android:layout_width="match_parent"

android:layout_height="wrap_content"

android:hint="Enter Phone Number" />

<EditText

android:id="@+id/e2"

android:layout_width="match_parent"

android:layout_height="wrap_content"

android:hint="Enter Message" />

<Button

android:id="@+id/b1"

android:layout_width="match_parent"

android:layout_height="wrap_content"

android:text="Send SMS" />

</LinearLayout>

MainActivity.java
public class MainActivity extends AppCompatActivity {

EditText e1,e2;

Button b1;

SmsReceiver smsReceiver = new SmsReceiver();

@Override

protected void onCreate(Bundle savedInstanceState) {

super.onCreate(savedInstanceState);

setContentView(R.layout.activity_main);

e1= findViewById(R.id.e1);

e2= findViewById(R.id.e2);

b1= findViewById(R.id.b1);

ActivityCompat.requestPermissions(this, new String[]{

Manifest.permission.SEND_SMS,

Manifest.permission.RECEIVE_SMS

}, 1);

btnSend.setOnClickListener(new View.onClickListener()

public void onClick(View v)

try

String s1=e1.getText().toString();

String s2=e2.getText().toString();

SmsManager sm=getDefault();

sm.sendTextMessage(s1, null,s2, null, null);


Toast.makeText(getApplicationContext(), "SMS Sent", Toast.LENGTH_SHORT).show();

catch (Exception e)

Toast.makeText(getApplicationContext(), "Failed to send SMS", Toast.LENGTH_SHORT).show();

});

registerReceiver(smsReceiver, new IntentFilter ("android.provider.Telephony.SMS_RECEIVED"));

6. Develop and application to send and receive SMS (Design minimal UI as per your choice. Write
XML, java, and manifest file) (6marks)

Ans.

package com.example.smsapp;

import ...

public class SmsReceiver extends BroadcastReceiver

public void onReceive(Context context, Intent intent)

Bundle bundle = intent.getExtras();

if (bundle != null)

Object[] pdus = (Object[]) bundle.get("pdus");

if (pdus != null)

SmsMessage sms = SmsMessage.createFromPdu((byte[])pdus[0]);

String phone = sms.getOriginatingAddress();


String message = sms.getMessageBody();

Toast.makeText(context, "From: " + phone + "\nMessage: "+ message,


Toast.LENGTH_SHORT).show();

<uses-permission android:name="android.permission.RECEIVE_SMS" />

<uses-permission android:name="android.permission.SEND_SMS"/>

<uses-permission android:name="android.permission.READ_SMS"/>

<uses-permission android:name="android.permission.WRITE_SMS"/>

<receiver

android:name=".SmsReceiver"

android:enabled="true"

android:exported="true">

<intent-filter>

<action android:name="android.provider.Telephony.SMS_RECEIVED" />

</intent-filter>

</receiver>

7. Develop an application to display Google map with user’s current location. (6marks)

Ans.

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

<LinearLayout

xmlns:android="http://schemas.android.com/apk/res/android"

xmlns:app="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=".MainActivity">

<fragment

android:layout_width="match_parent"

android:layout_height="match_parent"

android:id="@+id/google_map"

android:name="com.google.android.gms.maps.SupportMapFragment" />

</LinaerLayout>

MainActivity

package com.example.location;

import ...

public class MainActivity extends FragmentActivity implements OnMapReadyCallback

Location l1;

FusedLocationProviderClient fd;

int REQUEST_CODE = 101;

protected void onCreate(Bundle savedInstanceState)

super.onCreate(savedInstanceState);

setContentView(R.layout.activity_main);

fd =LocationServices.getFusedLocationProviderClient(this);

fetchLastLocation();

private void fetchLastLocation()


{

if (ActivityCompat.checkSelfPermission(this,Manifest.permission.ACCESS_FINE_LOCATION) !=
PackageManager.PERMISSION_GRANTED && ActivityCompat.checkSelfPermission(this,
Manifest.permission.ACCESS_COARSE_LOCATION) != PackageManager.PERMISSION_GRANTED)

ActivityCompat.requestPermissions(this,new
String[]{Manifest.permission.ACCESS_FINE_LOCATION},REQUEST_CODE);

return;

Task<Location> task = fusedLocationProviderClient.getLastLocation();

task.addOnSuccessListener(new OnSuccessListener<Location>()

public void onSuccess(Location location)

if(location!=null)

currentlocation=location;

Toast.makeText(getApplicationContext(),currentlocation.getLatitude()+""+currentlocation.get
Longitude(), Toast.LENGTH_SHORT).show();

SupportMapFragment supportMapFragment =
(SupportMapFragment)getSupportFragmentManager().findFragmentById(R.id.google_map);

supportMapFragment.getMapAsync(MainActivity.this);

});

public void onMapReady(@NonNull GoogleMap googleMap)

LatLng latLng=new LatLng(currentlocation.getLatitude(),currentlocation.getLongitude());

MarkerOptions mo =new MarkerOptions().position(latLng).title("I am Here");


googleMap.animateCamera(CameraUpdateFactory.newLatLng(latLng));

googleMap.animateCamera(CameraUpdateFactory.newLatLngZoom(latLng,5));

googleMap.addMarker(mo);

public void onRequestPermissionsResult(int requestCode, @NonNull String[] permissions, @NonNull


int[] grantResults)

super.onRequestPermissionsResult(requestCode, permissions, grantResults);

switch (requestCode)

case REQUEST_CODE:

if (grantResults.length > 0 && grantResults[0] == PackageManager.PERMISSION_GRANTED)

fetchLastLocation();

break;

Winter 2022

1. State how the APK files are built? (2marks)

Ans.

• The javac compiler compiles the java source file into the class file.

• The dx tool takes all the class files of your application and generates a single .dex file which is a platform
specific tool.

• Then Android Assets Packaging Tool (aapt) handles the packaging process and finally creates an
executable file with extension .apk.

• An APK file contains all of a program's code (such as .dex files), resources, assets, certificates, and
manifest file.
2. Name any four methods to get location data in android. (2marks)

Ans.

•float getAccuracy()

•float getBearing()

•float getSpeed()

•boolean hasAccuracy()

•boolean hasBearing()

•boolean hasSpeed()

3. Explain the Android security model. (4marks)

Ans.

Android Security Model

• The Android Security Model ensures that applications run securely without interfering with each other.

• Every application runs in its own Dalvik Virtual Machine (DVM), with a unique user ID (UID) assigned to
it.

• Sandboxing prevents an app from accessing other apps' data unless explicitly granted permission.

• Apps must be signed with a certificate, ensuring they can be traced back to their developer.

Real-Life Example

Example 1: If you install a game, it cannot access your contacts unless you grant permission

Permission-

• Permissions in Android are security mechanisms that restrict access to sensitive data and system
resources.

• Apps must request user approval before accessing features like contacts, location, and camera.

• Permissions ensure that malicious apps cannot misuse private information.

• There are different protection levels like Normal, Signature, and Dangerous Permissions.

Types of permission
1. Normal Permissions

• These allow access to non-sensitive system resources.

• Automatically granted at install time, without user approval.

• Example:

o VIBRATE – Allows vibration control.

o SET_WALLPAPER – Allows apps to change wallpaper.

• Syntax

<uses-permission android:name="android.permission.VIBRATE"/>

<uses-permission android:name="android.permission.SET_WALLPAPER"/>

2. Dangerous Permissions

• These involve access to private user data or critical system resources.

• User approval is required at runtime.

• Example:

o READ_SMS – Reads user messages.

o ACCESS_FINE_LOCATION – Fetches GPS location.

• Syntax

<uses-permission android:name="android.permission.READ_SMS"/>

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

3. Signature Permissions

• The app must be signed with the same certificate as the app that defines the permission.

• Used for secure communication between apps from the same developer.

• Example:

o USE_CREDENTIALS – Allows app to request authentication tokens.

o MANAGE_ACCOUNTS – Manages accounts stored on the device.

• Syntax

<uses-permission android:name="android.permission.USE_CREDENTIALS"/>

<uses-permission android:name="android.permission.MANAGE_ACCOUNTS"/>
4. Explain the steps to deploy app on Google Play Store. (4marks)

Ans. Same as Q2 Summer 2022

5. Explain the procedure of Geo-coding and reverse Geo-coding. (4marks)

Ans.

Geocoding-

• Geocoding is the process of converting an address (or place name) into latitude and longitude
coordinates.

• It helps find the exact geographical location of a place.

• Example:

Input: "Taj Mahal, Agra, India"

Output: Latitude: 27.1751, Longitude: 78.0421

Required Class and Methods for Geocoding & Reverse Geocoding

Geocoder Class

• The Geocoder class in Android fetches location details based on an address or coordinates.

• It requires an internet connection to fetch results.

• Syntax for Geocoder Class

Geocoder geocoder = new Geocoder(context, Locale.getDefault());

• Syntax for Geocoding

List<Address> addresses = geocoder.getFromLocationName("Taj Mahal, Agra", 1);

• Example Code for Geocoding

Geocoder geocoder = new Geocoder(this, Locale.getDefault());

try {

List<Address> addresses = geocoder.getFromLocationName("Taj Mahal, Agra", 1);

if (addresses.size() > 0) {

double latitude = addresses.get(0).getLatitude();

double longitude = addresses.get(0).getLongitude();

Log.d("Geocoding", "Latitude: " + latitude + ", Longitude: " + longitude);

}
} catch (IOException e) {

e.printStackTrace();

• Expected Output:

Latitude: 27.1751, Longitude: 78.0421

Reverse Geocoding?

• Reverse Geocoding is the process of converting latitude and longitude into a humanreadable address.

• It helps identify a location based on GPS coordinates.

• Example:

Input: Latitude: 40.7128, Longitude: -74.0060

Output: "New York, USA"

Syntax & Example for Reverse Geocoding (Coordinates → Address)

▪ Syntax for Reverse Geocoding

List<Address> addresses = geocoder.getFromLocation(latitude, longitude, 1);

▪ Example Code for Reverse Geocoding

Geocoder geocoder = new Geocoder(this, Locale.getDefault());

try {

List<Address> addresses = geocoder.getFromLocation(40.7128, -74.0060, 1);

if (addresses.size() > 0) {

String address = addresses.get(0).getAddressLine(0);

Log.d("Reverse Geocoding", "Address: " + address);

} catch (IOException e) {

e.printStackTrace();

▪ Expected Output:

Address: New York, USA


6. Develop an application to send and receive SMS (Write only Java and permission tag in manifest
file). (4marks)

Ans. Same as Q6 Summer 2024

7. Elaborate the need of permissions in Android. Explain the permissions to set system
functionalitics like SEND-SMS, bluetooth. (4marks)

Ans,

The purpose of a permission is to protect the privacy of an Android user. Android apps must request
permission to access sensitive user data (such as contacts and SMS), as well as certain

system features (such as camera and internet). Depending on the feature, the system might grant the
permission automatically or might prompt the user to approve the request.

• android. permission. SEND_SMS

Allows the app to send SMS messages. This may result in unexpected charges. Malicious apps may cost
you money by sending messages without your confirmation.

Following is the code snippet to set SEND_SMS permissions in manifest file.

<uses-permission android: name="android.permission.SEND_SMS"/>

• android. permission. BLUETOOTH

You need to provide following permissions in AndroidManifest.xml file.

<uses-permission android:name="android.permission.BLUETOOTH" />

<uses-permission android:name="android.permission.BLUETOOTH_ADMIN" />

8. Develop a program to send and receive an Email. (6marks)

Ans.

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

<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"

android:layout_width="match_parent"

android:layout_height="match_parent"

android:orientation="vertical"

android:padding="20dp">
<EditText

android:id="@+id/e1"

android:layout_width="match_parent"

android:layout_height="wrap_content"

android:hint="Enter Email Address" />

<EditText

android:id="@+id/e2"

android:layout_width="match_parent"

android:layout_height="wrap_content"

android:hint="Enter Subject" />

<EditText

android:id="@+id/e3"

android:layout_width="match_parent"

android:layout_height="wrap_content"

android:hint="Enter Message" />

<Button

android:id="@+id/b1"

android:layout_width="match_parent"

android:layout_height="wrap_content"

android:text="Send Email" />

</LinearLayout>

package com.example.emailapp;

import ...
public class MainActivity extends AppCompatActivity

EditText e1,e2,e3;

Button b1;

@Override

protected void onCreate(Bundle savedInstanceState) {

super.onCreate(savedInstanceState);

setContentView(R.layout.activity_main);

e1 = findViewById(R.id.e1);

e2 = findViewById(R.id.e2);

e3 = findViewById(R.id.e3);

b1 = findViewById(R.id.b1;

btnSend.setOnClickListener(new View.onClickListener()

public void onClick(View v)

String s1=e1.getText().toString();

String s2=e2.getText().toString();

String s3=e3.getText().toString();

Intent i = new Intent(Intent.ACTION_SEND);

i.putExtra(Intent.EXTRA_EMAIL, s1);

i.putExtra(Intent.EXTRA_SUBJECT, s2);

i.putExtra(Intent.EXTRA_TEXT, s3);

i.setType("message/rfc822");

startActivity(Intent.createChooser(i, "Choose an Email Client"));

});
}

Email Receive

package com.example.emailapp;

import...

public class EmailReceiver extends BroadcastReceiver

public void onReceive(Context context, Intent intent)

Toast.makeText(context, "New Email Received!", Toast.LENGTH_SHORT).show();

<receiver

android:name=".EmailReceiver">

<intent-filter>

<action android:name="android.intent.action.VIEW"/>

</intent-filter>

</receiver>

9. Write a program to find the direction from user's current location to MSBTE, Bandra. (Write
only Java and manifest file). (Note: Any other relevant logic to get the required output can also be
considered.) (6marks)

Ans.

Manifest file

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

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

<uses-permission android:name="android.permission.ACCESS_COARSE_LOCATION"/>
<meta-data

android:name="com.google.android.geo.API_KEY"

android:value="YOUR_API_KEY_HERE"/>

xml file

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

<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"

android:layout_width="match_parent"

android:layout_height="match_parent">

<fragment

android:id="@+id/google_map"

android:name="com.google.android.gms.maps.SupportMapFragment"

android:layout_width="match_parent"

android:layout_height="match_parent"/>

<Button

android:id="@+id/b1"

android:layout_width="wrap_content"

android:layout_height="wrap_content"

android:text="Get Directions" />

</RelativeLayout>

Java file

package com.example.googlemaps;

import ...
public class MainActivity extends AppCompatActivity implements OnMapReadyCallback

GoogleMap mMap;

Button b1;

FusedLocationProviderClient fd;

int LOCATION_PERMISSION_REQUEST = 101;

private LatLng userLocation, msbteLocation = new LatLng(19.0218, 72.8662);

@Override

protected void onCreate(Bundle savedInstanceState) {

super.onCreate(savedInstanceState);

setContentView(R.layout.activity_main);

fd = LocationServices.getFusedLocationProviderClient(this);

SupportMapFragment mapFragment =
getSupportFragmentManager().findFragmentById(R.id.google_map);

if (mapFragment != null)

mapFragment.getMapAsync(this);

b1 = findViewById(R.id.b1);

btnGetDirection.setOnClickListener(new View.onClickListener()

Public void onClick(View v)

openGoogleMapsNavigation()

});

public void onMapReady(@NonNull GoogleMap googleMap) {

mMap = googleMap;
if (ActivityCompat.checkSelfPermission(this, Manifest.permission.ACCESS_FINE_LOCATION) !=
PackageManager.PERMISSION_GRANTED)

ActivityCompat.requestPermissions(this, new
String[]{Manifest.permission.ACCESS_FINE_LOCATION}, LOCATION_PERMISSION_REQUEST);

return;

mMap.setMyLocationEnabled(true);

fusedLocationProviderClient.getLastLocation().addOnSuccessListener(this, location ->

if (location != null) {

userLocation = new LatLng(location.getLatitude(), location.getLongitude());

mMap.addMarker(new MarkerOptions().position(userLocation).title("Your Location"));

mMap.addMarker(new MarkerOptions().position(msbteLocation).title("MSBTE, Bandra"));

mMap.moveCamera(CameraUpdateFactory.newLatLngZoom(userLocation, 12));

else

Toast.makeText(MainActivity.this, "Unable to get location", Toast.LENGTH_SHORT).show();

});

private void openGoogleMapsNavigation()

if (userLocation != null) {

String uri = "google.navigation:q=" + msbteLocation.latitude + "," + msbteLocation.longitude;

startActivity(new Intent(Intent.ACTION_VIEW, Uri.parse(uri)));

else
{

Toast.makeText(this, "Location not found! Try again.", Toast.LENGTH_SHORT).show();

public void onRequestPermissionsResult(int requestCode, @NonNull String[] permissions, @NonNull


int[] grantResults)

super.onRequestPermissionsResult(requestCode, permissions, grantResults);

if (requestCode == LOCATION_PERMISSION_REQUEST && grantResults.length > 0 && grantResults[0]


== PackageManager.PERMISSION_GRANTED) {

recreate();

else

Toast.makeText(this, "Location Permission Denied", Toast.LENGTH_SHORT).show();

Summer 2023

1. Define SMS service in android application development. (2marks)

Ans.

SMS

• In Android, you can use SmsManager API or devices Built-in SMS application to send SMS's

• Android SMS is stored in PDU (protocol description unit) format

• SmsManager class takes care of sending the SMS message.

• We just need to get an instance of it and send the SMS message.

• We need to add permission to SEND_SMS in the Android manifest file.

SmsManager smsManager = SmsManager.getDefault();


smsManager.sendTextMessage("phoneNo", null, "sms message", null, null);

2. Describe process of getting the map API Key. (4marks)

Ans.

Creating API keys

The API key is a unique identifier that authenticates requests associated with your project for usage and
billing purposes. You must have at least one API key associated with your project.

1. Browse the site on your browser. https://console. developers. google.com/project

2. Login with your google account.

3. Create a new project by clicking on Create Project option.

4. Add your project name and organization name in the fields present on the screen.

5. Now click on APIs and Services.

6. Enable APIs and services.

7. Select Google maps Android API

8. To create an API key for Maps click on Create credentials option and then select the API key option Click
on the API key option to generate your API key. After clicking on this option your API key will be
generated

3. Describe steps for deploying android application on Google Play Store. (4marks)

Ans. Same as Q2 Summer 2022

4. Describe permissions required for android application development. (4marks)

Ans. Same as Q3 Winter 2022

5. Develop an android application to show current location of an user’s car (4marks)

Ans. Same as Q7 Summer 2022

6. Explain Geocoding and Reverse Geocoding with suitable example. (6marks)

Ans. Same as Q5 Winter 2022

7. Develop an android application for sending Short Message Service (SMS). (6marks)

Ans. Same as Q6 Summer 2022

Winter 2023

1. Define Geocoding and Reverse Geocoding (2marks)

Ans.
Geocoding :

Geocoding is the process of transforming a street address or other description of a location into a
(latitude, longitude) coordinate.

Reverse Geocoding :

Reverse geocoding is the process of transforming a (latitude, longitude) coordinate into a (partial)
address.

2. Develop a program to add “Hello World” marker at (10,10) co-ordinates. Write only. java file.
(4marks)

Ans.

package com.example.googlemap;

import...

public class MapsActivity extends FragmentActivity implements OnMapReadyCallback

GoogleMap mMap;

protected void onCreate(Bundle savedInstanceState)

super.onCreate(savedInstanceState);

setContentView(R.layout.activity_maps);

SupportMapFragment mapFragment = (SupportMapFragment)


getSupportFragmentManager().findFragmentById(R.id.map);

mapFragment.getMapAsync(this);

public void onMapReady(GoogleMap googleMap)

mMap = googleMap;

LatLng hello = new LatLng(10,10);

mMap.addMarker(new MarkerOptions().position(hello).title("Marker Hello World"));

mMap.moveCamera(CameraUpdateFactory.newLatLngZoom(mumbai,10F));
}

3. Elaborate Android Security Model. (4marks)

Ans. Same as Q3 Winter 2022

4. Develop an application to send and receive SMS. (Write only. java and permission tag in manifest
file). (4marks)

Ans, Same as Q6 Summer 2022

5. Develop an application to display a Google Map. (Write JAVA and Manifest file). (6marks)

Ans.

Manifest file

<usespermission android:name="android.permission.ACCESS_FINE_LOCATION" />

<usespermission android:name="android.permission.ACCESS_COARSE_LOCATION" />

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

<meta-data

android:name="com.google.android.geo.API_KEY"

android:value="@string/google_maps_key" />

package example.com.mapexample;

import ...

public class MapsActivity extends FragmentActivity implements OnMapReadyCallback

GoogleMap mMap;

protected void onCreate(Bundle savedInstanceState)

super.onCreate(savedInstanceState);

setContentView(R.layout.activity_maps);

SupportMapFragment mapFragment = (SupportMapFragment)


getSupportFragmentManager() findFragmentById(R.id.map);

mapFragment.getMapAsync(this);
}

public void onMapReady(GoogleMap googleMap)

mMap = googleMap;

LatLng sydney = new LatLng(-34, 151);

mMap.addMarker(new MarkerOptions().position(sydney).title("Marker in Sydney"));

mMap.moveCamera(CameraUpdateFactory.newLatLng(sydney));

6. i) Describe all steps in application deployment on google playstore.

Ans. Same as Q2 Summer 2024

ii) Write steps for customized permissions. (6marks)

Ans.

Steps for Customizing Permissions in Android

1 App Signing

• Every Android app must be signed with a unique certificate.

• This certificate is used to identify the app developer.

• Android allows self-signed certificates, meaning developers don’t need a third-party certificate
authority.

• The system uses app signatures to grant or deny permissions.

• Example: If two apps are signed with the same certificate, they can share data and permissions.

2 Granting Signature Permissions After Device Manufacturing

• From Android 12 (API level 31) onwards, developers can grant signature-level permissions after the
device is shipped.

• Uses the knownCerts attribute to verify the app’s certificate before granting permissions.

• The knownSigner flag ensures that permissions can be granted even if the app is installed later.

• Benefit: Manufacturers can pre-approve permissions without signing the app during manufacturing.
3 User IDs and File Access

• Every installed app is assigned a unique Linux User ID (UID).

• This UID remains the same as long as the app is installed on that device.

• Each app runs in its own process, preventing unauthorized access from other apps.

• By default, apps cannot access each other's data.

• Example:

o If App A stores files, App B cannot access them unless permission is explicitly granted.

4 Declaring Custom Permissions

• Developers can create custom permissions to restrict access to specific app features.

• This is done inside the AndroidManifest.xml file.

• Example:

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

package="com.example.myapp">

<permission

android:name="com.example.myapp.permission.CUSTOM_ACCESS"

android:label="Custom Access Permission"

android:description="Allows specific access to app features"

android:protectionLevel="dangerous" />

</manifest>

Summer 2024

1. Explain two methods of Google Map. (2marks)

Ans. Same as Q2 Winter 2022

2. Explain android security model. (marks)

Ans. Same as Q3 Winter 2022

3. Explain importance or use of developer console. (4marks)

Ans.

Google Play Developer Console is the platform that Google provides for Google Play and Android
developers to publish their apps.
● The Google Play Developer console allows app developers and marketers to better understand how
their apps are performing in terms of growth, technical performance such as crashes or display issues,
and financials.

● The console offers acquisition reports and detailed analysis which can help app devs find out how well
an app is really performing.

● The platform is important as it provides developers with access to first party data that highlights the
real performance of an app.

● It shows the number of impressions an app listing receives and the number of Installs an app receives
from different sources over time.

4. Write a program to create first display screen of any search engine using auto complete text
view. (4marks)

Ans.

<RelativeLayout

xmlns:android="http://schemas.android.com/apk/res/android"

xmlns:app="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=".MainActivity"

android:layout_gravity="center">

<AutoCompleteTextView

android:id="@+id/txt"

android:textSize="50dp"

android:layout_centerHorizontal="true"

android:hint="Enter Text to search"

android:layout_width="wrap_content"

android:layout_height="wrap_content" />

</RelativeLayout>

MainActivity.java
package com.example.al_libaansapp;

import ...

public class MainActivity extends AppCompatActivity

String[] fruits = {"apple", "mango", "banana", "kiwi", "pineapple", "guava", "grapes"};

AutoCompleteTextView txt;

protected void onCreate(Bundle savedInstanceState)

super.onCreate(savedInstanceState);

setContentView(R.layout.activity_main);

txt = findViewById(R.id.txt);

ArrayAdapter adp = new ArrayAdapter(this,android.R.layout.simple_dropdown_item_1line,


fruits);

txt.setThreshold(1);

txt.setAdapter(adp);

5. Develop a program to send an SMS (4marks)

Ans. Same as Q6 Summer 2022

6. Describe types of permissions used while developing android application. (4marks)

Ans. Same as Q3 Winter 2022

7. Write a program to show users current location. (6marks)

Ans. Same as Q7 Summer 2022

8. Write a program to send e-mail. (6marks)

Ans. Same as Q8 Winter 2022

Winter 2024

1. List types of permission in android. (2marks)

Ans. 1. Normal Permissions 2. Dangerous Permissions 3. Signature Permissions


2. Describe the process of getting the map API key. (2marks)

Ans. Same as Q2 2023 Winter

3. Describe the steps for publishing android app. (4marks)

Ans. Same as Q2 Summer 2022

4. Explain importance of developer console in android application development. (4marks)

Ans. Same as Q3 Summer 2024

5. Explain Geocoding and reverse geocoding in android with example. (4marks)

Ans. Same as Q5 Winter 2022

6. Write a program to find the direction from user’s current location to MSBTE, Bandra (Write only
java and manifest file) (6marks)

Ans. Same as Q9 Winter 2022

7. Develop and application to send SMS (Design minimal UI as per your choice. Write XML JAVA and
manifest file) (6marks)

Ans. Same as Q6 summer 2022

You might also like