Unit 1.
Introduction to Android
1.1 Introduction to Android, History and its Features,
Android operating system is the largest installed base among various
mobile platforms across the globe. Hundreds of millions of mobile
devices are powered by Android in more than 190 countries of the
world.
It conquered around 71% of the global market share by the end of
2021, and this trend is growing bigger every other day. The company
named Open Handset Alliance developed Android for the first time
that is based on the modified version of the Linux kernel and other
open-source software.
Google sponsored the project at initial stages and in the year 2005, it
acquired the whole company. In September 2008, the first
Android-powered device was launched in the market.
It’s user-friendly, has huge community support, provides a greater
extent of customization, and a large number of companies build
Android-compatible smartphones. As a result, the market observes a
sharp increase in the demand for developing Android mobile
applications, and with that companies need smart developers with the
right skill set.
At first, the purpose of Android was thought of as a mobile operating
system. However, with the advancement of code libraries and its
popularity among developers of the divergent domain, Android becomes
an absolute set of software for all devices like tablets, wearables, set-top
boxes, smart TVs, notebooks, etc.
What is Android?
Android is an open source software package that was developed primarily
to improve the mobile user experience and has now become the
best-selling operating system for mobile devices. Android is now a part of
Google and the Open Handset Alliance,
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.
The first beta version of the Android Software Development Kit (SDK)
was released by Google in 2007 where as the first commercial version,
Android 1.0, was released in September 2008.
On June 27, 2012, at the Google I/O conference, Google announced the
next Android version, 4.1 Jelly Bean. Jelly Bean is an incremental update,
with the primary aim of improving the user interface, both in terms of
functionality and performance.
The source code for Android is available under free and open source
software licenses. Google publishes most of the code under the Apache
License version 2.0 and the rest, Linux kernel changes, under the GNU
General Public License version 2.
Why Android ?
What is Open Handset Alliance (OHA)
It's a consortium of 84 companies such as google, samsung, AKM,
synaptics, KDDI, Garmin, Teleca, Ebay, Intel etc.
It was established on 5th November, 2007, led by Google. It is committed
to advance open standards, provide services and deploy handsets using
the Android Plateform.
Features of Android
Android is a powerful open-source operating system that open-source
provides immense features and some of these are listed below.
Android Open Source Project so we can customize the OS based
on our requirements.
Android supports different types of connectivity for GSM, CDMA,
Wi-Fi, Bluetooth, etc. for telephonic conversation or data transfer.
Using wifi technology we can pair with other devices while
playing games or using other applications.
It contains multiple APIs to support location-tracking services
such as GPS.
We can manage all data storage-related activities by using the file
manager.
It contains a wide range of media supports like AVI, MKV, FLV,
MPEG4, etc. to play or record a variety of audio/video.
It also supports different image formats like JPEG, PNG, GIF,
BMP, MP3, etc.
It supports multimedia hardware control to perform playback or
recording using a camera and microphone.
Android has an integrated open-source WebKit layout-based web
browser to support User Interfaces like HTML5, and CSS3.
Android supports multi-tasking means we can run multiple
applications at a time and can switch between them.
It provides support for virtual reality or 2D/3D Graphics.
Android Versions
Google first publicly announced Android in November 2007 but was
released on 23 SEPTEMBER 2008 to be exact. The first device to bring
Android into the market was the HTC Dream with the version Android
1.0. 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.
Code Name Version API level Release date
– September 23,
Android 1.0 1
2008
Code Name Version API level Release date
– Android 1.1 2 February 9, 2009
Cupcake Android 1.5 3 April 30, 2009
September 15,
Donut Android 1.6 4
2009
Eclair Android 2.0 – 2.1 5-7 October 26, 2009
Android 2.2 –
Froyo 8 May 20, 2010
2.2.3
Android 2.3 – December 6,
Gingerbread 9-10
2.3.4 2010
Android 3.0.x – February 22,
Honeycomb 11 – 13
3.2.x 2011
Ice Cream Android 4.0 –
14 – 15 October 18, 2011
Sandwich 4.0.4
Android 4.1 –
Jelly Bean 16 – 18 July 9, 2012
4.1.2
Android 4.4 –
Kitkat 19 July 9, 2012
4.4.4
Lollipop Android 5.0 – 5.1 21 – 22 October 17, 2014
Android 6.0 –
Marshmallow 23 October 5, 2015
6.0.1
Nougat Android 7.0 – 7.1 24 – 25 August 22, 2016
Code Name Version API level Release date
Oreo Android 8.0 26 August 21, 2017
Pie Android 9.0 27 August 6, 2018
September 3,
Android Q Android 10.0 29
2019
September 8,
Android 11 Android 11.0 30
2020
Android 12.0 –
Snow Cone 31-32 October 4, 2021
12.1
Tiramisu Android 13 33 August 15, 2022
Android 14 UPCOMING
Programming Languages used in Developing Android Applications
1. Java
2. Kotlin
Advantages of Android Development
The Android is an open-source Operating system and hence
possesses a vast community for support.
The design of the Android Application has guidelines from
Google, which becomes easier for developers to produce more
intuitive user applications.
Fragmentation gives more power to Android Applications. This
means the application can run two activities on a single screen.
Releasing the Android application in the Google play store is
easier when it is compared to other platforms.
Disadvantages of Android Development
Fragmentation provides a very intuitive approach to user
experience but it has some drawbacks, where the development team
needs time to adjust to the various screen sizes of mobile
smartphones that are now available in the market and invoke the
particular features in the application.
The Android devices might vary broadly. So the testing of the
application becomes more difficult.
As the development and testing consume more time, the cost of
the application may increase, depending on the application’s
complexity and features.
1.2 Architecture of Android
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
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.
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.
1.3 Android SDK and it’s Components
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.
About Android SDK
Android SDK is a collection of libraries and Software Development tools
that are essential for Developing Android Applications. 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.
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:
Android SDK Build tool.
Android Emulator.
Android SDK Platform-tools.
Android SDK Tools.
These are shown below :
2. Android SDK Build-Tools
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. The latest version of the Android SDK
Build tool is 30.0.3. While downloading or updating Android in our
System, one must ensure that its latest version is download in SDK
Components.
3. 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.
In Android Virtual Emulator all functions that are feasible on real
Android mobile is works on virtual Device like:
phone calls, text messages.
stimulate different network speeds.
specify the location of a device
access on google play store and lot’s more.
But there is one disadvantage of this emulator is that. It is very slow when
System’s PC has less RAM. It works fine when a maximum GB of RAM
is present on our device.
4. 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.
5. Android SDK Tools
Android SDK tool is a component of SDK tool. It consists of a set of
tools which and other Utilities which are crucial for the development of
Android Application. It contains the complete set of Debugging and
Development tools for android.
6. SDK Platforms
For Each Android Software, one SDK platform is available as shown
below:
Like in this Android 11.0(R) is installed.
These are numbered according to the android version. The new version of
the SDK platform has more features and more compatible but the old
version is less compatible with fewer features. Like in Android 11.0(R)
have more compatible and have more feature but the below versions like
Android 10.0(Q), Android4.4(KitKat) have less feature and is less
compatible.
7. SDK Update Sites
In SDK Update Sites, some sites are embedded in it which will check for
Android SDK Updates Tools. In this, one must ensure we don’t unclick
the button below because these are checked by default which will check
for updates if we will unclick it then it doesn’t check updates for those.
1.4 Installing Android
Android Studio is the official IDE (Integrated Development
Environment) for Android app development and it is based
on JetBrains’ IntelliJ IDEA software. Android Studio provides many
excellent features that enhance productivity when building Android apps,
such as:
A blended environment where one can develop for all Android
devices
Apply Changes to push code and resource changes to the running
app without restarting the app
A flexible Gradle-based build system
A fast and feature-rich emulator
GitHub and Code template integration to assist you to develop
common app features and import sample code
Extensive testing tools and frameworks
C++ and NDK support
Built-in support for Google Cloud Platform, making it easy to
integrate Google Cloud Messaging and App Engine, and many more.
Provides GUI tools that simplify the less interesting parts of app
development.
Easy integration with real time database ‘firebase’.
System Requirements
Microsoft Windows 7/8/10 (32-bit or 64-bit)
4 GB RAM minimum, 8 GB RAM recommended (plus 1 GB for
the Android Emulator)
2 GB of available disk space minimum, 4 GB recommended (500
MB for IDE plus 1.5 GB for Android SDK and emulator system
image)
1280 x 800 minimum screen resolution
Installation Guide
Step 1: From the android official website download 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 run it. It 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.
Click on next.
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.
Click on Next.
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.
1.5 Android Development Tools (ADT) and Creating
Android Virtual Devices (AVDs).
The Android operating system has been designed primarily for
touchscreen mobile devices such as smartphones and tablet computers.
Developed Initially by Android, Inc., backed financially by Google (later
bought by Google in 2005), Android was introduced in 2007 with the
founding of the Open Handset Alliance (a consortium of hardware,
software, and telecommunication companies devoted to advancing open
standards for mobile devices).
Here are the Top 5 Android Development tools currently trending in the
market.
1. Android SDK
2. Native Development Kit (NDK)
3. Titanium Mobile SDK
4. Hypernext Android Creator
5. ADOBE AIR
5 Android app development tools you
1. Android SDK:
The Android Software Development Kit (SDK) provides you with the
API libraries and developer tools necessary to build, test, and debug apps
for the Android platform. It is one of the most popular SDKs used for
Android.
Aspiring new Android developers can download the ADT Bundle to
develop apps quickly. It includes the essential Android SDK components
and a version of the Eclipse IDE with built-in ADT (Android Developer
Tools) to streamline your Android app development. These are some of
the pivotal components in the ADT Bundle
Eclipse + ADT plugin
Android SDK Tools
Android Platform tools
Current Version of the Android platform
Current Version of the Android system image for the emulator
2. Native Development Kit (NDK):
The NDK is a toolset that allows Android developers to implement parts
of their app using native-code languages such as C and C++. NDK can
help developers as they can reuse existing code libraries written in these
languages. The most significant point to be considered here is that NDK
will not benefit most apps.
The developer needs to balance its gains over drawbacks as the native
code may not always increase the performance but generally increases the
complexity. Use NDK only if it is essential to your app but not because
you prefer to program in C/C++.
3. Titanium Mobile SDK:
The Titanium SDK provides community developers with an unmatched
ability to create quality native, mobile, web, or rich hybrid applications to
all platforms from a single code base using JavaScript.
Although Titanium Mobile SDK suffers from some disadvantages like
flexibility limitations, User Experience issues, and complexity issues,
Titanium still stands in the first place for Android and other
cross-platform apps development.
4. Hypernext Android Creator:
HyperNext Android Creator (HAC) is an easy-to-use software creation
system that allows almost anyone to build their Android apps. Mobile
apps developed on HAC enjoy good support on a wide range of devices.
5. ADOBE AIR:
The Adobe® AIR® runtime enables developers to package the same
code into native apps for iPhone, iPad, and other Android™ devices,
reaching the mobile app stores for over 500 million devices. Running on
Action Script, HTML, CSS, AIR allows users to develop cross-platform
mobile apps saving time and minimizing the development cost.
The Android emulator is an Android Virtual Device (AVD), which
represents a specific Android device. We can use the Android emulator as
a target device to execute and test our Android application on our PC.
The Android emulator provides almost all the functionality of a real
device. We can get the incoming phone calls and text messages. It also
gives the location of the device and simulates different network speeds.
Android emulator simulates rotation and other hardware sensors. It
accesses the Google Play store, and much more
Testing Android applications on emulator are sometimes faster and easier
than doing on a real device. For example, we can transfer data faster to
the emulator than to a real device connected through USB.
The Android emulator comes with predefined configurations for several
Android phones, Wear OS, tablet, Android TV devices.
Requirement and recommendations
The Android emulator takes additional requirements beyond the basic
system requirement for Android Studio. These requirements are given
below:
o SDK Tools 26.1.1 or higher
o 64-bit processor
o Windows: CPU with UG (unrestricted guest) support
o HAXM 6.2.1 or later (recommended HAXM 7.2.0 or later)
Install the emulator
The Android emulator is installed while installing the Android Studio.
However some components of emulator may or may not be installed
while installing Android Studio. To install the emulator component,
select the Android Emulator component in the SDK Tools tab of
the SDK Manager.
Run an Android app on the Emulator
We can run an Android app form the Android Studio project, or we can
run an app which is installed on the Android Emulator as we run any app
on a device.
To start the Android Emulator and run an application in our project:
1. In Android Studio, we need to create an Android Virtual Device
(AVD) that the emulator can use to install and run your app. To create a
new AVD:-
1.1 Open the AVD Manager by clicking Tools > AVD Manager.
1.2 Click on Create Virtual Device, at the bottom of the AVD Manager
dialog. Then Select Hardware page appears.
1.3 Select a hardware profile and then click Next. If we don?t see the
hardware profile we want, then we can create or import a hardware
profile. The System Image page appears.
1.4 Select the system image for the particular API level and
click Next. This leads to open a Verify Configuration page.
1.5 Change AVD properties if needed, and then click Finish.
2. In the toolbar, choose the AVD, which we want to run our app from the
target device from the drop-down menu.
3. Click Run.
AD
Launch the Emulator without first running an app
To start the emulator:
1. Open the AVD Manager.
2. Double-click an AVD, or click Run
While the emulator is running, we can run the Android Studio project and
select the emulator as the target device. We can also drag an APKs file to
install on an emulator, and then run them.