0% found this document useful (0 votes)
32 views11 pages

Introduction to Android Development

Safety

Uploaded by

fairleyjames747
Copyright
© All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
32 views11 pages

Introduction to Android Development

Safety

Uploaded by

fairleyjames747
Copyright
© All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd

P a g e |1

Introduction to Android Development


The 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 75% of the global market share by the end of 2020, 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 launched in the market. Android
dominates the mobile OS industry because of the long list of features it provides. 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.

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.

Code Name Version API level Release date

Apple Pie Android 1.0 1 September 23, 2008

Banana Bread Android 1.1 2 February 9, 2009

Cupcake Android 1.5 3 April 30, 2009

Donut Android 1.6 4 September 15, 2009

Eclair Android 2.0 – 2.1 5-7 October 26, 2009


P a g e |4

Code Name Version API level Release date

Froyo Android 2.2 – 2.2.3 8 May 20, 2010

Gingerbread Android 2.3 – 2.3.4 9-10 December 6, 2010

Honeycomb Android 3.0.x – 3.2.x 11 – 13 February 22, 2011

Ice Cream Sandwich Android 4.0 – 4.0.4 14 – 15 October 18, 2011

Jelly Bean Android 4.1 – 4.1.2 16 – 18 July 9, 2012

Kitkat Android 4.4 – 4.4.4 19 July 9, 2012

Lollipop Android 5.0 – 5.1 21 – 22 October 17, 2014

Marshmallow Android 6.0 – 6.0.1 23 October 5, 2015

Nougat Android 7.0 – 7.1 24 – 25 August 22, 2016

Oreo Android 8.0 26 August 21, 2017

Pie Android 9.0 27 August 6, 2018

Android Q Android 10.0 29 September 3, 2019

Android 11 Android 11.0 30 September 8, 2020

Programming Languages used in Developing Android Applications


1. Java
2. Kotlin
Developing the Android Application using Kotlin is preferred by Google, as Kotlin is made an official
language for Android Development, which is developed and maintained by JetBrains. Previously before
the Java is considered the official language for Android Development. Kotlin is made official for
Android Development in Google I/O 2017.
P a g e |5

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 for user experience but it has some drawbacks,
where the development team needs time to adjust with 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.

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

Components of an Android Application


There are some necessary building blocks that an Android application consists of. These loosely
coupled components are bound by the application manifest file which contains the description of each
component and how they interact. The manifest file also contains the app’s metadata, its hardware
configuration, and platform requirements, external libraries, and required permissions.
There are the following main components of an android app:

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

public class MainActivity extends Activity {


}

To read more, refer to the article: Introduction to Activities in Android

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

public class ServiceName extends Service {


}

To read more, refer to the article: Services in Android with Example

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

public class contentProviderName extends ContentProvider {


P a g e |9

public void onCreate(){}


}

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

Introduction to Activities in Android


Activity class is one of the very important parts of the Android component. Any app, don’t matter
how much small it is (in terms of code and scalability), it has at least one Activity class. Unlike most
of the programming languages, in which the main() method is the entry point for that program or
application to start its execution, the android operating system initiates the code in an Activity
instance by invoking specific callback methods that correspond to specific stages of its lifecycle. So
it can be said that An activity is the entry point for interacting with the user. Every activity contains
the layout, which has a user interface to interact with the user. As we know that every activity
contains a layout associated with it, so it can be said that activity class is the gateway, through
which a user can interact programmatically with UI. Layout for a particular activity is set with the
help of setContentView(). setContentView() is a function that takes View as a parameter. The
view parameter basically contains the layout file for that activity. The following images indicate
that activity_main is the layout file of MainActivity.
In the case of Java:

In the case of Kotlin:

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 [Link].

Declaring Activity in Manifest File


Open the app folder, and then open the subfolder manifest, and then open
the [Link] file.

Common questions

Powered by AI

An open-source platform like Android allows developers to access the source code of the operating system and modify it according to their needs, which fosters significant innovation and customization. This openness leads to a vast developer community that provides support and contributes to the improvement of the platform. Being backed by a large community also means there is a wealth of tools, frameworks, and libraries available to speed up development and solve common problems. Additionally, open-source platforms can be audited more thoroughly for security vulnerabilities, making community-driven improvements possible .

Android Runtime comprises the core libraries and the Dalvik Virtual Machine (DVM). These components provide foundational support for Android applications, with core libraries allowing the use of standard Java or Kotlin, and the DVM enabling applications to run with efficient memory management and threading capability. DVM is particularly designed for Android, optimized for low memory and processing power devices, which in turn enhances app performance by enabling multiple applications to run simultaneously without significant resource overhead .

The Android application manifest file is a critical component that serves as the central configuration file for the app. It declares essential information such as the app's package name, components like activities and services, required permissions, and the app's hardware and software requirements. By doing so, it ensures the Android system understands how to interact with the application's different parts, manages the application's lifecycle, and integrates with the device's capabilities. It plays a critical role in enabling and governing interactions between app components and the Android operating system .

Android applications utilize several components to deliver comprehensive functionality: Activities provide the user-facing interface, interacting with the user through the lifecycle management. Services operate in the background to perform tasks without direct UI interaction. Content Providers manage data sharing and persistence, enabling databases or shared preferences across different apps. Broadcast Receivers act as listeners for system-wide broadcast announcements, allowing applications to respond to system or app-specific events. Together, these components enable Android apps to handle complex operations seamlessly and interact both with the device and other applications effectively .

Android's market fragmentation offers the advantage of allowing applications to be tailored for a vast array of devices, providing flexibility and reaching a broader audience. However, it imposes significant challenges during development and testing, as the same application must perform consistently across numerous device types, screen sizes, and system versions. This diversity complicates the development cycle, requiring extensive testing and optimization, potentially increasing costs and time to market. The need for comprehensive analytics and feedback loops to accommodate various user experiences also becomes crucial .

The Linux Kernel forms the core layer of Android architecture, providing essential services such as device management, memory management, process management, and network stack operations. It acts as an abstraction layer between hardware and software, managing interactions via hardware drivers. Its importance lies in its stability, security features, and efficiency in resource management, which allows Android devices to perform complex tasks while optimizing battery and system performance .

Android supports a wide array of features that enhance user experience, such as various connectivity options (GSM, CDMA, Wi-Fi, Bluetooth), media playback (supporting formats like AVI, MKV, MP3), and web browsing capabilities via an integrated WebKit-based browser. Connectivity options allow extensive interoperability for communication and data transfer, while versatile media support provides rich audio and visual interactions. WebKit integration ensures efficient web content rendering and user interaction through modern web technologies, significantly enhancing the smartphone's usability and functionality .

API levels define the functionalities available to developers in a given Android version, and changes across versions can impact backward compatibility. Maintaining backward compatibility ensures that applications run on a wide range of devices, allowing developers to target older devices while harnessing new features on newer ones. However, as new functionalities are introduced and older APIs deprecated, developers must carefully manage these transitions to prevent app crashes and maintain a satisfactory user experience across diverse devices. Effective use of compatibility libraries and conditional code paths becomes essential .

Kotlin has been an official language for Android application development since Google I/O 2017 due to its modern features that speed up development, reduce boilerplate code, and improve safety through null safety mechanisms. Compared to Java, Kotlin offers more concise syntax and expressive language features like data classes and extension functions. While Java is still widely used due to its robust community and extensive libraries, Kotlin's interoperability with existing Java code makes it a favorable choice for new projects and existing Java-based applications looking to modernize .

Since its initial release with Android 1.0 in 2008, which introduced basic smartphone functionalities, Android has significantly evolved through various versions with increased functionalities and features like multitasking, enriched media support, and improvements in user interactivity. Each subsequent update brought higher API levels with specific enhancements—for instance—Lollipop introduced material design, while Oreo focused on security and performance optimizations. This evolution reflects Android's commitment to providing more robust, user-friendly, and secure platforms, retaining its position as a leading mobile OS with a large user base and developer community .

You might also like