Introduction to Android Development
Introduction to Android Development
Features of Android
Android is a powerful open-source operating system that open-source provides immense features and
some of these are listed below.
P a g e |2
a. Android Open Source Project so we can customize the OS based on our requirements.
b. Android supports different types of connectivity for GSM, CDMA, Wi-Fi, Bluetooth, etc. for
telephonic conversation or data transfer.
c. Using wifi technology we can pair with other devices while playing games or using other
applications.
d. It contains multiple APIs to support location-tracking services such as GPS.
e. We can manage all data storage related activities by using the file manager.
f. It contains a wide range of media supports like AVI, MKV, FLV, MPEG4, etc. to play or record a
variety of audio/video.
g. It also supports different image formats like JPEG, PNG, GIF, BMP, MP3, etc.
h. It supports multimedia hardware control to perform playback or recording using a camera and
microphone.
i. Android has an integrated open-source WebKit layout based web browser to support User Interface
like HTML5, CSS3.
j. Android supports multi-tasking means we can run multiple applications at a time and can switch in
between them.
k. It provides support for virtual reality or 2D/3D Graphics
P a g e |3
Android Versions
Google launched the first version of the Android platform on Nov 5, 2007. Since then, Google released
a lot of android versions such as Apple Pie, Banana Bread, Cupcake, Donut, Éclair, Froyo, Gingerbread,
Jellybeans, Kitkat, Lollipop, marshmallow, Nougat, Oreo, etc. with extra functionalities and new
features.
The following table shows the version details of android which is released by Google from 2007 to
date.
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
P a g e |6
Pictorial representation of android architecture with several main components and their sub
components –
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. will be installed on this layer only.
It runs within the Android run time with the help of the classes and services provided by the
application framework.
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. Generally, it provides the services with the help of which we can
create a particular class and make that class helpful for the Applications creation.
It includes different types of services activity manager, notification manager, view system, package
manager etc. which are helpful for the development of our application according to the prerequisite.
P a g e |7
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. It depends on the layer Linux kernel for threading and low-level memory management.
The core libraries enable us to implement android applications using the standard JAVA or Kotlin
programming languages.
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.
P a g e |8
1. Activities
Activities are said to be the presentation layer of our applications. The UI of our application is built
around one or more extensions of the Activity class. By using Fragments and Views, activities set the
layout and display the output and also respond to the user’s actions. An activity is implemented as a
subclass of class Activity.
• Java
2. Services
Services are like invisible workers of our app. These components run at the backend, updating your
data sources and Activities, triggering Notification, and also broadcast Intents. They also perform
some tasks when applications are not active. A service can be used as a subclass of class Service:
• Java
3. Content Providers
It is used to manage and persist the application data also typically interacts with the SQL database.
They are also responsible for sharing the data beyond the application boundaries. The Content
Providers of a particular application can be configured to allow access from other applications, and the
Content Providers exposed by other applications can also be configured. A content provider should be
a sub-class of the class ContentProvider.
• Java
To read more, refer to the article: Content Providers in Android with Example
4. Broadcast Receivers
They are known to be intent listeners as they enable your application to listen to the Intents that satisfy
the matching criteria specified by us. Broadcast Receivers make our application react to any received
Intent thereby making them perfect for creating event-driven applications.
To read more, refer to the article: Broadcast Receiver in Android With Example
5. Intents
It is a powerful inter-application message-passing framework. They are extensively used throughout
Android. Intents can be used to start and stop Activities and Services, to broadcast messages system-
wide or to an explicit Activity, Service or Broadcast Receiver or to request action be performed on a
particular piece of data.
To read more, refer to the article: Intent and Intent Filters
6. Widgets
These are the small visual application components that you can find on the home screen of the devices.
They are a special variation of Broadcast Receivers that allow us to create dynamic, interactive
application components for users to embed on their Home Screen.
7. Notifications
Notifications are the application alerts that are used to draw the user’s attention to some particular
app event without stealing focus or interrupting the current activity of the user. They are generally
used to grab user’s attention when the application is not visible or active, particularly from within a
Service or Broadcast Receiver. Examples: E-mail popups, Messenger popups, etc.
P a g e | 10
While activities are often presented to the user as the full-screen window, Multiwindow mode, or
Picture in Picture mode, here are two methods almost all subclasses of Activity will implement:
1. onCreate()
2. onPause()
1. onCreate() Method
Syntax:
protected void onCreate(Bundle savedInstanceState)
▪ onCreate(Bundle) method is the place, where the user initializes the activity. This method is
called when the activity is starting. This is the method that is used to initialize most of the
P a g e | 11
things in the android app. onCreate() method takes savedInstanceState as the parameter,
which the object of type Bundle, i.e Bundle Object which contains the previously saved data of
the activity. If the activity is newly created then the bundle won’t be saving any data of the
activity and would contain the null value.
▪ onCreate() method calls the setContentView() method to set the view corresponding to the
activity. By default in any android application, setContentView point to activity_main.xml file,
which is the layout file corresponding to MainActivity. The onCreate method uses
the findViewById() method so that the user can interact programmatically with the widgets in
android and then customize them according to need.
Bundle: If the activity is being re-initialized or restarted after previously being closed, then this
Bundle contains the data it most recently supplied in
onSaveInstanceState(Bundle). onSaveInstanceState() method is the method that is called to save
the data just before our activity is killed.
2. onPause() Method
Syntax:
protected void onPause()
This method is called as part of the activity lifecycle when the user no longer actively interacts with
the activity, but it is still visible on the screen. Let’s suppose the user is running two apps
simultaneously on a mobile phone, i.e when activity B is launched in front of activity A, so activity A
will go in the onPause() state, and activity B would go in the onStart() state of the activity lifecycle.
One important point to be remembered is that for any activity to be accessed by system, ie android
here, that activity must be declared in a manifest file. The manifest file is an XML file included in
the application and default known as AndroidManifest.xml.