Unit 6
Unit 6
Summer 2022
Ans.
UiSettings.setZoomControlsEnabled(true);
2. List and elaborate steps to deploy an Android application on Google play store. (4marks)
Ans.
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.
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.
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.
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.’
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.
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.
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.
• Example:
a. getFromLocation
Syntax
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 :
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.
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
● 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.
<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"
<EditText
android:id="@+id/e2"
android:layout_width="match_parent"
android:layout_height="wrap_content"
<Button
android:id="@+id/b1"
android:layout_width="match_parent"
android:layout_height="wrap_content"
</LinearLayout>
MainActivity.java
public class MainActivity extends AppCompatActivity {
EditText e1,e2;
Button b1;
@Override
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
e1= findViewById(R.id.e1);
e2= findViewById(R.id.e2);
b1= findViewById(R.id.b1);
Manifest.permission.SEND_SMS,
Manifest.permission.RECEIVE_SMS
}, 1);
btnSend.setOnClickListener(new View.onClickListener()
try
String s1=e1.getText().toString();
String s2=e2.getText().toString();
SmsManager sm=getDefault();
catch (Exception e)
});
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 ...
if (bundle != null)
if (pdus != null)
<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>
</intent-filter>
</receiver>
7. Develop an application to display Google map with user’s current location. (6marks)
Ans.
<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 ...
Location l1;
FusedLocationProviderClient fd;
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
fd =LocationServices.getFusedLocationProviderClient(this);
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.addOnSuccessListener(new OnSuccessListener<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);
});
googleMap.animateCamera(CameraUpdateFactory.newLatLngZoom(latLng,5));
googleMap.addMarker(mo);
switch (requestCode)
case REQUEST_CODE:
fetchLastLocation();
break;
Winter 2022
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()
Ans.
• 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.
• There are different protection levels like Normal, Signature, and Dangerous Permissions.
Types of permission
1. Normal Permissions
• Example:
• Syntax
<uses-permission android:name="android.permission.VIBRATE"/>
<uses-permission android:name="android.permission.SET_WALLPAPER"/>
2. Dangerous Permissions
• Example:
• 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:
• 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.
Geocoding-
• Geocoding is the process of converting an address (or place name) into latitude and longitude
coordinates.
• Example:
Geocoder Class
• The Geocoder class in Android fetches location details based on an address or coordinates.
try {
if (addresses.size() > 0) {
}
} catch (IOException e) {
e.printStackTrace();
• Expected Output:
Reverse Geocoding?
• Reverse Geocoding is the process of converting latitude and longitude into a humanreadable address.
• Example:
try {
if (addresses.size() > 0) {
} catch (IOException e) {
e.printStackTrace();
▪ Expected Output:
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.
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.
Ans.
<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"
<EditText
android:id="@+id/e2"
android:layout_width="match_parent"
android:layout_height="wrap_content"
<EditText
android:id="@+id/e3"
android:layout_width="match_parent"
android:layout_height="wrap_content"
<Button
android:id="@+id/b1"
android:layout_width="match_parent"
android:layout_height="wrap_content"
</LinearLayout>
package com.example.emailapp;
import ...
public class MainActivity extends AppCompatActivity
EditText e1,e2,e3;
Button b1;
@Override
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()
String s1=e1.getText().toString();
String s2=e2.getText().toString();
String s3=e3.getText().toString();
i.putExtra(Intent.EXTRA_EMAIL, s1);
i.putExtra(Intent.EXTRA_SUBJECT, s2);
i.putExtra(Intent.EXTRA_TEXT, s3);
i.setType("message/rfc822");
});
}
Email Receive
package com.example.emailapp;
import...
<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
<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"
</RelativeLayout>
Java file
package com.example.googlemaps;
import ...
public class MainActivity extends AppCompatActivity implements OnMapReadyCallback
GoogleMap mMap;
Button b1;
FusedLocationProviderClient fd;
@Override
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()
openGoogleMapsNavigation()
});
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);
if (location != null) {
mMap.moveCamera(CameraUpdateFactory.newLatLngZoom(userLocation, 12));
else
});
if (userLocation != null) {
else
{
recreate();
else
Summer 2023
Ans.
SMS
• In Android, you can use SmsManager API or devices Built-in SMS application to send SMS's
Ans.
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.
4. Add your project name and organization name in the fields present on the screen.
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)
7. Develop an android application for sending Short Message Service (SMS). (6marks)
Winter 2023
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...
GoogleMap mMap;
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_maps);
mapFragment.getMapAsync(this);
mMap = googleMap;
mMap.moveCamera(CameraUpdateFactory.newLatLngZoom(mumbai,10F));
}
4. Develop an application to send and receive SMS. (Write only. java and permission tag in manifest
file). (4marks)
5. Develop an application to display a Google Map. (Write JAVA and Manifest file). (6marks)
Ans.
Manifest file
<meta-data
android:name="com.google.android.geo.API_KEY"
android:value="@string/google_maps_key" />
package example.com.mapexample;
import ...
GoogleMap mMap;
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_maps);
mapFragment.getMapAsync(this);
}
mMap = googleMap;
mMap.moveCamera(CameraUpdateFactory.newLatLng(sydney));
Ans.
1 App Signing
• Android allows self-signed certificates, meaning developers don’t need a third-party certificate
authority.
• Example: If two apps are signed with the same certificate, they can share data and permissions.
• 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
• 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.
• Example:
o If App A stores files, App B cannot access them unless permission is explicitly granted.
• Developers can create custom permissions to restrict access to specific app features.
• 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:protectionLevel="dangerous" />
</manifest>
Summer 2024
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:layout_width="wrap_content"
android:layout_height="wrap_content" />
</RelativeLayout>
MainActivity.java
package com.example.al_libaansapp;
import ...
AutoCompleteTextView txt;
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
txt = findViewById(R.id.txt);
txt.setThreshold(1);
txt.setAdapter(adp);
Winter 2024
6. Write a program to find the direction from user’s current location to MSBTE, Bandra (Write only
java and manifest file) (6marks)
7. Develop and application to send SMS (Design minimal UI as per your choice. Write XML JAVA and
manifest file) (6marks)