Q.Explain Dalvik Virtual Machine and state its importance.
The Dalvik Virtual Machine (DVM) is an android virtual machine optimized for mobile devices.
Dalvik VM is also a virtual machine that is highly optimized for mobile devices.
Thus, it provides all the three things, that are memory management, high performance as well as battery life
The Dex compiler converts the class files into the .dex file that run on the Dalvik VM. Multiple class files are converted into
one dex file.
The javac tool 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. It is a platform-specific tool.
The Android Assets Packaging Tool (aapt) handles the packaging process.
Q.Describe the process of getting the map API key.
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
Q.Explain need of android.
Android is a new generation mobile OS which runs on Linux kernel. There are some following points which describe why we
use Android OS:
1. Desktop: The Android phone adds widgets to the desktop. The purpose for the widget, for
example, the Facebook widget allows us to update our facebook desktop. The people widget allows us to make possible
different actions for different contacts right from our desktop.
The
message widget allows us to immediately see our e-mail from the desktop.
2. Connectivity: On one page/desktop we could be able to have four connecting device tool button like, Turn ON/OFF
Bluetooth, Turn ON/OFF WiFi, Turn ON/OFF mobile network, Turn On/Off GPS and so on. These buttons let us
switch ON/OFF instantly which will help us to conserve battery life.
3. Browser: The Android OS browser is one of the best browsers on the mobile market. It generally loads pages faster
than Safari or any other browser, has Flash support and simply does everything a browser should do. For example,
iPhone has Safari browser. It is stable, has no Flash support, so we cannot watch Youtube videos or any related
contents, it is not flexible but monopolistic.
4. Open to Carrier: If we know Java programming language then we are open to Android world.
5. Market: Android OS has an android market. The android apps are free and work as well.
6. Future: The future mobile phones are basically going to be smart phones.
7. Muti-Notification: Android phones have multi-notification system. With android the app have access to the
notification system and call all report.
8. Google Integration: The Android has inbuilt google support. For examle, Google Map, G-Mail etc.
9. Open Source: The code of android OS as well as the apps is available.
Q.Compare JVM and DVM. (any four points)
JVM DVM
JVM supports multiple operating DVM supports only Android Operating
systems. System.
JVM forms separate classes in separate DVM forms multiple class in .dex byte
code file.
.class byte code files.
It is based on stack based virtual machine It is based on Register based virtual
architecture. machine architecture.
JVM runs on more memory. DVM runs on less memory.
The executable format of JVM is JAR. The executable format of DVM is APK.
JVM has different constant pools. DVM has common constant pool.
It runs .class byte code directly. The .class byte codes are optimized to
.odex format before executing in DVM.
Q.Explain importance or use of developer console.
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.
Describe android and importance of OHA.
Android
Android is an open source and Linux-based Operating System .It is designed primarily for touch screens mobile
devices such as smartphones and tablet computers. Android offers a unified approach to application development
for mobile devices which means developers need only develop for Android, and their applications should be able
to run on different devices powered by Android.
Android was developed by the Open Handset Alliance, led by Google, and other companies.
OHA
• The Open Handset Alliance (OHA) is a business alliance that was created for the purpose of
developing open mobile device standards.
• The OHA has approximately 80 member companies, including HTC, Dell, Intel, Motorola,
Qualcomm and Google.
Importance of OHA
• Lower overall handset costs: Opens up resources, which facilitates the focus on creating innovative
applications, solutions and services.
• Developer-friendly environment: In the open-source community, developers share notes to expedite
application development.
Post-development: Provides an ideal channel for application marketing and distribution.
Q.Explain android security model.
Android is a multi-process system, in which each application (and parts of the system) runs in its own process.
Most security between applications and the system is enforced at the process level through standard Linux facilities,
such as user and group IDs that are assigned to applications.
Additional finer-grained security features are provided through a “permission” mechanism that enforces restrictions
on the specific operations that a particular process can perform, and per-URI permissions for granting ad-hoc access
to specific pieces of data.
The Android security model is primarily based on a sandbox and permission mechanism. Each application is
running in a specific Dalvik virtual machine with a unique user ID assigned to it, which means the application code
runs in isolation from the code of all others applications. As a consequence, one application has not granted access
to other applications’ files.
Android application has been signed with a certificate with a private key Know the owner of the application is
unique.
This allows the author of The application will be identified if needed.
When an application is installed in The phone is assigned a user ID, thus avoiding it from affecting it Other
applications by creating a sandbox for it. This user ID is permanent on which devices and applications with the same
user ID are allowed to run in a single process. This is a way to ensure that a malicious application has Can not access
/ compromise the data of the genuine application.
It is mandatory for an application to list all the resources it will Access during installation.
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).
Permissions are divided into several protection levels. The protection level affects whether runtime permission
requests are required.
Android introduced shared user ID & permission to allow application components talk to each other & enable
application to access to critical system in Android devices.
Q.Draw and explain activity life cycle.
onCreate (): Called then the activity is created. Used to initialize the activity, for example create the user interface.
onStart ():called when activity is becoming visible to the user.
onResume (): Called if the activity get visible again and the user starts interacting with the activity again. Used to
initialize fields, register listeners, bind to services, etc.
onPause (): Called once another activity gets into the foreground. Always called before the activity is not visible
anymore. Used to release resources or save application data. For example you unregister listeners, intent receivers,
unbind from services or remove system service listeners.
onStop (): Called once the activity is no longer visible. Time or CPU intensive shutdown operations, such as writing
information to a database should be down in the onStop() method. This method is guaranteed to be called as of API
11.
onDestroy (): called before the activity is destroyed.
1. Activity States:
The Android OS uses a priority queue to assist in managing activities running on the device. Based on the state a
particular Android activity is in, it will be assigned a certain priority within the OS.the states an activity can go
through, during its lifetime:
These states are often broken into three main teams as follows:
1. Active or Running:
Activities are thought of active or running if they're within the foreground, additionally referred to as the top of the
activity stack. this can be thought of the highets priority activity within the Android Activity stack, and as such only
be killed by the OS in extreme things, like if the activity tries to use more memory than is available on the device as
this might cause the UI to become unresponsive.
2. Paused:
When the device goes to sleep, or an activity continues to be visible but partially hidden by a new, non-full-sized or
clear activity, the activity is taken into account paused. Paused activities are still alive, that is, they maintain all state
and member information, and stay attached to the window manager.
3. Stopped:
Activities that are utterly obscured by another activity are thought of stopped or within the background. Stopped
activities still try and retain their state and member info for as long as possible but stopped activities are thought of
to be loweat priority of the three states and, as such, the OS can kill activities during this state initial to satisfy the
resource needs of higher priority activities.
Q.Explain multimedia framework in android.
Multimedia framework
• The android multimedia system includes multimedia applications, multimedia framework, OpenCore
engine and hardware abstract for audio/video input/output devices.
• The goal of the android multimedia framework is to provide a consistent interface for Java services.
• The multimedia framework consists of several core dynamic libraries such as libmediajni, libmedia,
libmediaplayservice and so on
• Java classes call the Native C library Libmedia through Java JNI (Java Native Interface).
• Libmedia library communicates with Media Server guard process through Android’s Binder IPC (inter
process communication) mechanism.
• Media Server process creates the corresponding multimedia service according to the Java multimedia
applications. The whole communication between Libmedia and Media Server forms a Client/Server model.
• In Media Server guard process, it calls OpenCore multimedia engine to realize the specific multimedia
processing functions. And the OpenCore engine refers to the PVPlayer and PVAuthor.
Q.Describe various installation steps of android studio and its environment.
Step 1: Go to Android https://developer.android.com/studio to get the Android Studio executable or zip file.
Step 2:
● Click on the Download Android Studio Button.
● Click on the “I have read and agree with the above terms and conditions” checkbox followed by the
download button
● Click on the Save file button in the appeared prompt box and the file will start downloading.
Step 3:
After the downloading has finished, open the file from downloads and will prompt the following dialog box. Click
on next. In the next prompt, it’ll ask for a path for installation. Choose a path and hit next.
Step 4:
It will start the installation, and once it is completed, it will be like the image shown below.
Step 5:
Once “Finish” is clicked, it will ask whether the previous settings need to be imported [if the android studio had
been installed earlier], or not. It is better to choose the ‘Don’t import Settings option’. Click the OK button.
Step 6:
This will start the Android Studio. Meanwhile, it will be finding the available SDK components.
Step 7:
After it has found the SDK components, it will redirect to the Welcome dialog box. Choose Standard and click on
Next. Now choose the theme, whether the Light theme or the Dark one. The light one is called the IntelliJ theme
whereas the dark theme is called Dracula.
Choose as required. Click on the Next button.
Step 8:
Now it is time to download the SDK components. Click on Finish. Components begin to download let it
complete. The Android Studio has been successfully configured. Now it’s time to launch and build apps. Click on
the Finish button to launch it.
Step 9:
Click on Start a new Android Studio project to build a new app.
Q.Describe directory structure and its components.
The android project contains different types of app modules, source code files, and resource files.
1. Manifests Folder
2. Java Folder
3. res (Resources) Folder
4. Drawable Folder
5. Layout Folder
6. Mipmap Folder
7. Values Folder
4. Gradle Scripts
Manifests Folder
Manifests folder contains AndroidManifest.xml for creating our android application. This file contains information
about our application such as the Android version, metadata, states package for Kotlin file, and other application
components. It acts as an intermediator between android OS and our application.
Java folder
The Java folder contains all the java source code (.java) files that we create during the app development, including
other Test files. If we create any new project using Java, by default the class file MainActivity.java will be created.
Resource (res) folder
The resource folder is the most important folder because it contains all the non-code sources like images, XML
layouts, and UI strings for our android application.
res/drawable folder
It contains the different types of images used for the development of the application. We need to add all the
images in a drawable folder for the application development.
res/layout folder
The layout folder contains all XML layout files which we used to define the user interface of our application. It
contains the activity_main.xml file
res/mipmap folder
This folder contains launcher.xml files to define icons that are used to show on the home screen. It contains
different density types of icons depending upon the size of the device such as hdpi, mdpi, xhdpi.
res/values folder
Values folder contains a number of XML files like strings, dimensions, colors, and style definitions. One of the
most important files is the strings.xml file which contains the resources.
Q.Explain scrollview with its attributes and with suitable example.
ScrollView
ScrollView is used to scroll the child elements of palette inside ScrollView. Android supports vertical scroll view as default
scroll view. Vertical ScrollView scrolls elements vertically.Android uses HorizontalScrollView for horizontal ScrollView.
Attributes of ScrollView
• android:fillViewport - Defines whether the scrollview should stretch its content to fill the viewport.
• android:scrollbars - scrollbars attribute is used to show the scrollbars in horizontal or vertical direction
• android:layout_width – Define the width
• android:layout_height – Define height
• android:id – Define id
Example :
<?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:paddingLeft="10dp" android:paddingRight="10dp">
<ScrollView xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:fillViewport="true"
android:scrollbars="vertical">
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="vertical"
android:padding="16dp">
<TextView
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:text="Header"
android:textSize="24sp"
android:textStyle="bold"/>
<!-- Repeat many views to make it scrollable -->
<TextView
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:text="Item 1"
android:padding="8dp" />
<TextView
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:text="Item 2"
android:padding="8dp" />
<!-- Add more items as needed -->
</LinearLayout>
</ScrollView>
</LinearLayout>
Q.Write significance of SQLite database in android.
• SQLite is an open-source relational database i.e. used to perform database operations on android
devices such as storing, manipulating or retrieving persistent data from the database.
• It is embedded in android bydefault. So, there is no need to perform any database
setup or administration task.
• SQLite is one way of storing app data. It is very lightweight database that comes with Android OS.
• By default, Android comes with built-in SQLite Database support so we don’t need to do any
configurations.
• Android stores our database in a private disk space that’s associated with our application and the data is
secure, because by default this area is not accessible to other applications.
• The package android.database.sqlite contains all the required APIs to use an SQLite database in our
android applications.
• In android, by using SQLiteOpenHelper class we can easily create the required database and tables for
our application. To use SQLiteOpenHelper, we need to create a subclass that overrides the onCreate() and
onUpgrade() call-back methods.
• SQLiteDatabase class contains methods to be performed on sqlite database such as create, update, delete,
select etc.
• We can insert data into the SQLite database by passing ContentValues to insert() method.
• In android, we can read the data from the SQLite database using the query() method in android
applications.
We can update the data in the SQLite database using an update() method in android applications.
Describe types of permissions used while developing android application.
Types of permissions
1. Install-time permissions
• Install-time permissions give your app limited access to restricted data, and they allow your app to perform
restricted actions that minimally affect the system or other apps.
• When you declare install-time permissions in your app, the system automatically grants your app the
permissions when the user installs your app.
Android includes several sub-types of install-time permissions, Normal permissions and Signature permissions.
a) Normal permissions
• These permissions allow access to data and actions that extend beyond your app's sandbox.
• However, the data and actions present very little risk to the user's privacy, and the operation of other apps.
b) Signature permissions
• If the app declares a signature permission that another app has defined, and if the two apps are signed by
the same certificate, then the system grants the permission to the first app at install time. Otherwise, that
first app cannot be granted the permission.
2. Runtime permissions
• Runtime permissions, also known as dangerous permissions, give your app additional access to restricted
data, and they allow your app to perform restricted actions that more substantially affect the system and
other apps.
• Many runtime permissions access private user data, a special type of restricted data that includes
potentially sensitive information. Examples of private user data include location and contact information.
• The system assigns the "dangerous" protection level to runtime permissions.
3. Special permissions
Special permissions correspond to particular app operations.
Only the platform and OEMs can define special permissions
Q.Service lifecycle
Service Lifecycle in Android
In Android, a Service is an application component that performs long-running operations in the background. It
does not have a user interface. The Service Lifecycle describes how a service is created, started, executed, and
destroyed by the system.
Types of Services :
1. Started Service
o Started by calling startService().
o Runs indefinitely, even if the component that started it is destroyed.
o You must stop it manually using stopSelf() or stopService().
2. Bound Service
o Bound to an activity or another component using bindService().
o Runs only as long as the bound component is active.
o Automatically destroyed when all clients unbind.
Q.Android architecture
Android architecture is organized in layers that provide a structured way to develop applications
and manage system components. It is divided into five main layers, from low-level system to
high-level user applications.