MobileApplicationDevelopment

Download as pptx, pdf, or txt
Download as pptx, pdf, or txt
You are on page 1of 26

Android Architecture

Android architecture contains different number of components


to support any android device needs. Android software
contains an open-source Linux Kernel having collection of
number of C/C++ libraries which are exposed through an
application framework services. Among all the components
Linux Kernel provides main functionality of operating system
functions to smartphones and Dalvik Virtual Machine (DVM)
provide platform for running an android application. The main
components of android architecture are following:-
• Applications
• Application Framework
• Android Runtime
• Platform Libraries
• Linux Kernel
Applications –
Applications is the top layer of android
architecture. The pre-installed applications like
home, contacts, camera, gallery etc and third
party applications downloaded from the play
store like chat applications, games etc.
Application framework –
Application Framework provides several important
classes which are used to create an Android
application. It provides a generic abstraction for
hardware access and also helps in managing the user
interface with application resources.
Application runtime –
Android Runtime environment is one of the most
important part of Android. It contains components
like core libraries and the Dalvik virtual
machine(DVM). Mainly, it provides the base for the
application framework and powers our application
with the help of the core libraries. Like Java Virtual
Machine (JVM), Dalvik Virtual Machine (DVM) is a
register-based virtual machine and specially
designed and optimized for android to ensure that
a device can run multiple instances efficiently.
Platform libraries –
The Platform Libraries includes various C/C++ core libraries and Java
based libraries such as Media, Graphics, Surface Manager, OpenGL
etc. to provide a support for android development.
Media library provides support to play and record an audio and video
formats.
Surface manager responsible for managing access to the display
subsystem.
SGL and OpenGL both cross-language, cross-platform application
program interface (API) are used for 2D and 3D computer graphics.
SQLite provides database support and FreeType provides font
support.
Web-Kit This open source web browser engine provides all the
functionality to display web content and to simplify page loading.
SSL (Secure Sockets Layer) is security technology to establish an
encrypted link between a web server and a web browser.
Linux Kernel –
Linux Kernel is heart of the android architecture. It manages all the
available drivers such as display drivers, camera drivers, Bluetooth
drivers, audio drivers, memory drivers, etc. which are required
during the runtime. The Linux Kernel will provide an abstraction
layer between the device hardware and the other components of
android architecture. It is responsible for management of memory,
power, devices etc. The features of Linux kernel are:
Security: The Linux kernel handles the security between the
application and the system.
Memory Management: It efficiently handles the memory
management thereby providing the freedom to develop our apps.
Process Management: It manages the process well, allocates
resources to processes whenever they need them.
Network Stack: It effectively handles the network communication.
Driver Model: It ensures that the application works properly on the
device and hardware manufacturers responsible for building their
drivers into the Linux build.
Dalvik Virtual Machine | DVM
• As we know the modern JVM is high performance and
provides excellent memory management. But it needs
to be optimized for low-powered handheld devices as
well.
• The Dalvik Virtual Machine (DVM) is an android virtual
machine optimized for mobile devices. It optimizes the
virtual machine for memory, battery
life and performance.
• Dalvik is a name of a town in Iceland. The Dalvik VM was
written by Dan Bornstein.
• 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.
Difference Table

JVM(Java Virtual Machine) DVM(Dalvik Virtual Machine)

Stack-based VM that performs Register-based VM that uses


arithmetic and logic operations registers located in the CPU to
through push and pop operands. perform arithmetic and logic
The result of operations is stored operations.
in stack memory.

Source code files are first of all


compiled into Java bytecode
Java source code is compiled into format like JVM. Further, the DEX
Java bytecode format(.class file) compiler(dx tool) converts the
that further translates into Java bytecode into Dalvik
machine code. bytecode(classes.dex) file that
will be used to create the .apk
file.
The executable file for the The executable file for the
device is .jar file. device is .apk file.

A single instance of JVM is The device runs multiple DVM


configured with shared instances with a separate
processes and memory space in process in shared memory
order to run all deployed space to deploy the code of
applications. each application.

Supports multiple operating Support only the Android


systems like Linux, Windows, operation system.
and Mac OS.
Android Activity Lifecycle

• Android Activity Lifecycle is controlled by 7


methods of android.app.Activity class. The
android Activity is the subclass of
ContextThemeWrapper class.

• An activity is the single screen in android. It is


like window or frame of Java.

• By the help of activity, you can place all your UI


components or widgets in a single screen.
Method Description

onCreate called when activity is first


created.
onStart called when activity is
becoming visible to the
user.
onResume called when activity will
start interacting with the
user.
onPause called when activity is not
visible to the user.
onStop called when activity is no
longer visible to the user.
onRestart called after your activity is
stopped, prior to start.
onDestroy called before the activity is
destroyed.
Android Development Tools (ADT)

• Android Development Tools (ADT) is a plugin for


the Eclipse IDE that provides a powerful,
integrated environment for building Android
apps.
• ADT extends the capabilities of Eclipse to let
you quickly set up new Android projects, create
an application UI, debug your apps using the
Android SDK tools, etc.
First released 2012
Developed by Google
Latest stable version ADT 4
Open-source Yes
Android SDK
• The Android SDK is a software development
kit for the Android software ecosystem that
includes a comprehensive set of
development tools.
• These include a debugger, libraries, a handset
emulator based on QEMU, documentation,
sample code, and tutorials.
• The SDK is part of the official Android Studio
IDE but its various tools and resources can be
used independently.
• Android SDK stands for Android Software Development
Kit which is developed by Google for Android Platform.
With the help of Android SDK, we can create android Apps
easily.

• Android SDK is a collection of libraries and Software


Development tools that are essential for Developing
Android Applications.

• Android SDK tool is an important component of Android


SDK. It consists of a complete set of development and
debugging tools. Below are the SDK developer tools:
• Android SDK Build tool.
• Android Emulator.
• Android SDK Platform-tools.
• Android SDK Tools.
Get the Android 11 SDK
• After you install and open Android Studio, install the
Android 11 SDK as follows:

• Click Tools > SDK Manager.

• In the SDK Platforms tab, expand the Android 11.0


("R") section and select the Android SDK Platform
30 package.

• In the SDK Tools tab, expand the Android SDK Build-


Tools 34 section and select the latest 30.x.x version.

• Click Apply > OK to download and install the selected


packages.
Views and Layout in Android
EditText Button Checkbox

ListView TextView ImageView

RadioButton RelativeLayout Progressbar

LinearLayout TableLayout ActionBar

FrameLayout Constraint layout WebView

AbsoluteLayout AutoComplete Spinner


TextView
Sensor Type Common Uses
TYPE_ACCELEROMETER Hardware Motion detection (shake,
tilt, etc.).

TYPE_AMBIENT_TEMPERAT Hardware Monitoring air


URE temperatures.

TYPE_GRAVITY Software or Hardware Motion detection (shake,


tilt, etc.).

TYPE_GYROSCOPE Hardware Rotation detection (spin,


turn, etc.).

TYPE_LIGHT Hardware Controlling screen


brightness.

TYPE_LINEAR_ACCELERATI Software or Hardware Monitoring acceleration


ON along a single axis.
TYPE_MAGNETIC_FIELD Hardware Creating a compass.
TYPE_ORIENTATION Software Determining device
position.

TYPE_PRESSURE Hardware Monitoring air pressure


changes.
TYPE_PROXIMITY Hardware Phone position during a
call.

TYPE_RELATIVE_HUMIDIT Hardware Monitoring dewpoint,


Y absolute, and relative
humidity.

TYPE_ROTATION_VECTOR Software or Hardware Motion detection and


rotation detection.
TYPE_TEMPERATURE Hardware Monitoring
temperatures.
Type of permissions in android

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.
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.
3) Special permissions

Special permissions correspond to particular app


operations. Only the platform and OEMs can
define special permissions. Additionally, the
platform and OEMs usually define special
permissions when they want to protect access to
particularly powerful actions, such as drawing over
other apps.
Android SQLite Database
• SQLite is a opensource SQL database that stores
data to a text file on a device. Android comes in
with built in SQLite database implementation.

• To perform the basic CRUD (Create, Read,


Update, and Delete) operation with SQLite
Database in Android.

• SQLite supports all the relational database


features. In order to access this database, you
don't need to establish any kind of connections
for it like JDBC,ODBC e.t.c

You might also like