You are on page 1of 31

Course Code : CA- CCTP-7

Course Title : - Mobile


Application Development
Using Android
UNIT I - ANDROID
FUNDAMENTALS

UNIT - I ANDROID FUNDAMENTALS MS. DIPALI B. TAWAR


1
Introduction
•Android is an open-source operating system based on Linux with a Java
programming interface for mobile devices such as Smartphone (Touch
Screen Devices who supports Android OS) as well for Tablets too and
now has become the best-selling operating system for mobile devices.
•In 2007, Google released a first beta version of the Android Software
Development Kit (SDK) and the first commercial version of
Android 1.0 (with name Alpha), was released in September 2008.
• As time passes newer versions of Android is get developed which are:
Apple, Pie, Banana Bread, Cupcake, Donut, Éclair, Froyo, Gingerbread
Honeycomb, Ice Cream Sandwich, JellyBean, Kitkat, Lollipop
Marshmallow, Nougat.
•The current version of the Android operating system is Oreo (version
8.0), which was released in August 2017.

UNIT - I ANDROID FUNDAMENTALS


2
MS. DIPALI B. TAWAR
Why Android?

UNIT - I ANDROID FUNDAMENTALS


3
MS. DIPALI B. TAWAR
Features
•It’s open-source and we can customize the OS based on our requirements.
•It supports connectivity for GSM, CDMA, WIFI, NFC, Bluetooth, etc. for telephony or data transfer. It
will allow us to make or receive a calls / SMS messages and we can send or retrieve data across mobile
networks
•By using WIFI technology we can pair with other devices using apps
•Android has multiple APIs to support location-based services such as GPS
•We can perform all data storage related activities by using lightweight database SQLite.
•It has a wide range of media supports like AVI, MKV, FLV, MPEG4, etc. to play or record a variety of
audio/video and having a different image format like JPEG, PNG, GIF, BMP, MP3, etc.
•It has extensive support for multimedia hardware control to perform playback or recording using camera
and microphone
•It has an integrated open-source WebKit layout based web browser to support HTML5, CSS3
•It supports a multi-tasking, we can move from one task window to another and multiple applications can
run simultaneously
•It will give a chance to reuse the application components and the replacement of native applications.
•We can access the hardware components like Camera, GPS, and Accelerometer
•It has support for 2D/3D Graphics

UNIT - I ANDROID FUNDAMENTALS


4
MS. DIPALI B. TAWAR
Architecture

UNIT - I ANDROID FUNDAMENTALS


5
MS. DIPALI B. TAWAR
Cont. Architecture
1) Linux Kernel
Linux Kernel is a bottom layer and heart of the android
architecture. It manages all the drivers such as display
drivers, camera drivers, Bluetooth drivers, audio drivers,
memory drivers, etc. which are mainly required for the
android device during the runtime.
The Linux Kernel will provide an abstraction layer between
the device hardware and the remainder of the stack. It is
responsible for memory management, power management,
device management, resource access, etc.

UNIT - I ANDROID FUNDAMENTALS


6
MS. DIPALI B. TAWAR
Cont. Architecture
2) Platform Libraries
It includes various C/C++ core libraries and Java-based libraries such as
SSL, libc, Graphics, SQLite, Webkit, Media, Surface Manger, OpenGL,
etc. to provide support for Android development.
The following are the summary details of some core android libraries
available for android development.
•Media library for playing and recording audio and video formats
•The Surface manager library to provide a display management
•SGL and OpenGL Graphics libraries for 2D and 3D graphics
•SQLite is for database support and FreeType for font support
•Web-Kit for web browser support and SSL for Internet security.

UNIT - I ANDROID FUNDAMENTALS


7
MS. DIPALI B. TAWAR
Cont. Architecture
3) Android Runtime
Android Runtime environment is an important part of Android rather
than an internal part and it contains components like core libraries and
the Dalvik virtual machine. The Android run time is the engine that
powers our applications along with the libraries and it forms the basis for
the application framework.
Dalvik Virtual Machine (DVM) is a register-based virtual machine
like Java Virtual Machine (JVM). It is specially designed and optimized
for android to ensure that a device can run multiple instances efficiently.
It relies on the Linux kernel for threading and low-level memory
management.
The core libraries in android runtime will enable us to implement
android applications using standard JAVA programming language.

UNIT - I ANDROID FUNDAMENTALS


8
MS. DIPALI B. TAWAR
Cont. Architecture
4) Application Framework
The Application Framework provides the classes used to
create Android applications. It also provides a generic
abstraction for hardware access and manages the user
interface and application resources. It basically provides the
services through which we can create a particular class and
make that class helpful for the Application creation.
The application framework includes services like telephony
service, location services, notification manager, NFC service,
view system, etc. which can use for application development
as per our requirements.

UNIT - I ANDROID FUNDAMENTALS


9
MS. DIPALI B. TAWAR
Cont. Architecture
5) Applications
The top layer of the android architecture is Applications.
The native and third-party applications like contacts, email,
music, gallery, clock, games, etc. whatever we will build
those will be installed on this layer only.
The application layer runs within the Android run time using
the classes and services made available from the application
framework.

UNIT - I ANDROID FUNDAMENTALS MS. DIPALI


10
B. TAWAR
Components of an Android
Application
The basic components of an Android application are:
1) Activity: An activity is a class that is considered as an entry point
for users that represents a single screen. A messenger application might
have an activity that shows a new notification, another activity which
reads messages and another which composes a new message. Each
activity is independent of one another. It is like a Frame in AWT.
2) Services: A service is a component that runs in the background, it
acts as an invisible worker of our application. It keeps updating data
sources and activities. There are two types of services local and remote.
Local service is accessed from within the application whereas remote
service is accessed remotely from other applications running on the
same device.
An example of service is we can surf the internet or use any other
application while listening to music.

UNIT - I ANDROID FUNDAMENTALS


11
MS. DIPALI B. TAWAR
Cont.….Components of an
Android Application
3) Content Provider : A content provider component supplies data from one
application to others on request. Such requests are handled by the methods of
the ContentResolver class. The data may be stored in the file system, the
database or somewhere else entirely. Content Providers are used to share data
between the applications.
A content provider is implemented as a subclass of ContentProvider class
and must implement a standard set of APIs that enable other applications to
perform transactions.
4) Broadcast Receiver: Broadcast Receiver is a component that
responds to broadcast messages from another application or the same
system. It can also deliver broadcasts to applications that are not
running. For example – notify the user that the battery is low. Android
developers can use broadcast messages in the application or outside the
normal flow.

UNIT - I ANDROID FUNDAMENTALS


12
MS. DIPALI B. TAWAR
Additional Components of Android
App Development
Several other additional components are a part of an Android App:
1. Intents
Intents are a powerful component in any android application. It allows
various applications and various activities to communicate with each
other. It carries information of which activity shall be going next or
which activity to stop or destroy. We even use intent to transfer data
from one activity to another.
2) View
A view is the UI element such as button, label, text field etc. Anything
that you see is a view.

UNIT - I ANDROID FUNDAMENTALS


13
MS. DIPALI B. TAWAR
Additional Components of
Android App Development
3) Fragments
A fragment is a portion of the total user interface. Users can combine
more than one fragment in a single activity and these fragments can be
reused in multiple activities. A fragment generally
contains Views and ViewGroups inside them.

UNIT - I ANDROID FUNDAMENTALS


14
MS. DIPALI B. TAWAR
AndroidManifest.xml file
The AndroidManifest.xml file contains information of your package,
including components of the application such as activities, services,
broadcast receivers, content providers etc.
It performs some other tasks also:
•It is responsible to protect the application to access any protected parts
by providing the permissions.
•It also declares the android api that the application is going to use.
•It lists the instrumentation classes. The instrumentation classes provides
profiling and other information's. These information's are removed just
before the application is published etc.
•This is the required xml file for all the android application and located
inside the root directory.

UNIT - I ANDROID FUNDAMENTALS


15
MS. DIPALI B. TAWAR
Elements of the
AndroidManifest.xml file
The elements used in the xml file are as follows:
1) manifest: manifest is the root element of the AndroidManifest.xml file. It
has package attribute that describes the package name of the activity class.
2) application: application is the sub element of the manifest. It includes
the namespace declaration. This element contains several sub elements that
declares the application component such as activity etc.
The commonly used attributes are of this element are icon, label, theme etc.
android:icon represents the icon for all the android application components.
android:label works as the default label for all the application components.
android:theme represents a common theme for all the android activities.

UNIT - I ANDROID FUNDAMENTALS


16
MS. DIPALI B. TAWAR
Cont.……Elements of the
AndroidManifest.xml file
3) activity: activity is the sub element of application and represents an activity
that must be defined in the AndroidManifest.xml file. It has many attributes such
as label, name, theme, launchMode etc.
android:label represents a label i.e. displayed on the screen.
android:name represents a name for the activity class. It is required attribute.
4) intent-filter: intent-filter is the sub-element of activity that describes the type
of intent to which activity, service or broadcast receiver can respond to.
5) action
It adds an action for the intent-filter. The intent-filter must have at least one action
element.
6) category
It adds a category name to an intent-filter.

UNIT - I ANDROID FUNDAMENTALS


17
MS. DIPALI B. TAWAR
Cont.…..Service Life Cycle

UNIT - I ANDROID FUNDAMENTALS MS. DIPALI B. TAWAR 18


Service Life Cycle
Android service is a component that is used to perform
operations on the background such as playing music, handle
network transactions, interacting content providers etc. It
doesn't has any UI (user interface).
The service runs in the background indefinitely even if
application is destroyed.
There can be two forms of a service. The lifecycle of service
can follow two different paths: started or bound.
1.Started
2.Bound

UNIT - I ANDROID FUNDAMENTALS


19
MS. DIPALI B. TAWAR
Cont.…..Service Life Cycle
1) Started Service
A service is started when component (like activity)
calls startService() method, now it runs in the background
indefinitely. It is stopped by stopService() method. The
service can stop itself by calling the stopSelf() method.
2) Bound Service
A service is bound when another component (e.g. client)
calls bindService() method. The client can unbind the
service by calling the unbindService() method.

UNIT - I ANDROID FUNDAMENTALS


20
MS. DIPALI B. TAWAR
Cont.…..Service Life Cycle
▪The entire lifetime of a service happens between the time
onCreate() is called and the time onDestroy() returns.
▪A service does its initial setup in onCreate(), and releases all
remaining resources in onDestroy().
▪The active lifetime of a service begins with a call to
onStart(). This method is handed the Intent object that was
passed to startService().

UNIT - I ANDROID FUNDAMENTALS


21
MS. DIPALI B. TAWAR
Cont.…..Service Life Cycle
Call Back Function Description
The system calls this method when another component, such as an
activity, requests that the service be started, by calling startService(). If
onStartCommand()
you implement this method, it is your responsibility to stop the service
when its work is done, by calling stopSelf() or stopService() methods.
The system calls this method when another component wants to bind with
the service by calling bindService(). If you implement this method, you
must provide an interface that clients use to communicate with the
onBind()
service, by returning an IBinder object. You must always implement this
method, but if you don't want to allow binding, then you should
return null.
The system calls this method when all clients have disconnected from a
onUnbind()
particular interface published by the service.
The system calls this method when new clients have connected to the
onRebind() service, after it had previously been notified that all had disconnected in
its onUnbind(Intent).

UNIT - I ANDROID FUNDAMENTALS


22
MS. DIPALI B. TAWAR
Cont.…..Service Life Cycle

Call Back Function Description


The system calls this method when the service is first created
onCreate() using onStartCommand() or onBind(). This call is required to
perform one-time set-up.
The system calls this method when the service is no longer used
onDestroy() and is being destroyed. Your service should implement this to clean
up any resources such as threads, registered listeners, receivers, etc.

UNIT - I ANDROID FUNDAMENTALS


23
MS. DIPALI B. TAWAR
Activity Life cycle

UNIT - I ANDROID FUNDAMENTALS


24
MS. DIPALI B. TAWAR
Cont.….. Activity Life cycle
▪Android Activity Lifecycle is controlled by 7 methods of
android.app.Activity class. The android Activity is the
subclass of ContextThemeWrapper class.
▪The 7 lifecycle method of Activity describes how activity
will behave at different states.
▪The 7 lifecycle methods of android activity are as follows:

UNIT - I ANDROID FUNDAMENTALS


25
MS. DIPALI B. TAWAR
Cont.….. Activity Life cycle
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.

UNIT - I ANDROID FUNDAMENTALS


26
MS. DIPALI B. TAWAR
SDK Overview
The Android SDK (Software Development Kit) is a set of
development tools that are used to develop applications for the
Android platform.
Whenever Google releases a new version or update of Android
Software, a corresponding SDK also releases with it. In the
updated or new version of SDK, some more features are included
which are not present in the previous version.
Android SDK consists of some tools which are very essential for
the development of Android Application. These tools provide a
smooth flow of the development process from developing and
debugging. Android SDK is compatible with all operating
systems such as Windows, Linux, macOS, etc.

UNIT - I ANDROID FUNDAMENTALS MS. DIPALI B. TAWAR 27


Cont.…..
Components of Android SDK
Android SDK Components play a major role in the Development of Android
applications. Below are the important components:
1. Android SDK Tools
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:
a) Android SDK Build tool.
b) Android Emulator.
c) Android SDK Platform-tools.
d) Android SDK Tools.

UNIT - I ANDROID FUNDAMENTALS MS. DIPALI B. TAWAR 28


Cont.…..
a) Android SDK Build tool:- Android SDK build tools are used for
building actual binaries of Android App. The main functions of Android
SDK Build tools are built, debug, run and test Android applications.
b) Android Emulator:- An Android Emulator is a device that simulates
an Android device on your system. Suppose we want to run our android
application that we code. One option is that we will run this on our
Android Mobile by Enabling USB Debugging on our mobile. Another
option is using Android Emulator. In Android Emulator the virtual
android device is shown on our system on which we run the Android
application that we code.
Thus, it simply means that without needing any physical device Android
SDK component “Android Emulator” provides a virtual device on the
System where we run our Application. The emulator’s come with the
configuration for Various android phones, tablets, Wear OS, and
Android TV devices.
UNIT - I ANDROID FUNDAMENTALS MS. DIPALI B. TAWAR 29
Cont.…..
c) Android SDK Platform-tools:- Android SDK Platform-tools is
helpful when we are working on Project, and they will show the error
messages at the same time. It is specifically used for testing. It includes:
•Android Debug Bridge (ADB), is a command-line tool that helps to
communicate with the device. It allows us to perform an action such as
Installing App and Debugging App etc.
•Fastboot allows you to flash a device with a new system image.
•Systrace tools help to collect and inspect timing information. It is very
crucial for App Debugging.
d) Android SDK Tools
Android SDK tool is a component of SDK tool. It consists of a set of
tools which are crucial for the development of Android Application. It
contains the complete set of Debugging and Development tools for
android.

UNIT - I ANDROID FUNDAMENTALS MS. DIPALI B. TAWAR 30


Cont.…..
2) SDK Update Sites
SDK Update Sites consist of collections of different websites which are
required for installation for different SDK components inside your
android SDK. This update sites section consists of website links for
different google websites which provides installation details for different
SDK components in Android SDK.

UNIT - I ANDROID FUNDAMENTALS MS. DIPALI B. TAWAR 31

You might also like