Android Unit-01
Android Unit-01
It is free and open-source software. Its source code is Android Open Source Project (AOSP), primarily
licensed under the Apache License. However, most Android devices dispatch with additional proprietary
software pre-installed, mainly Google Mobile Services (GMS), including core apps such as Google Chrome,
the digital distribution platform Google Play and the associated Google Play Services development
platform.
o About 70% of Android Smartphone runs Google's ecosystem, some with vendor-customized user
interface and some with software suite,
o 1. Custom ROMs
Because the Android operating system is open-source, developers can twist the current OS and
build their versions, which users can download and install in place of the stock OS. Some are filled
with features, while others change the look and feel of a device. Chances are, if there's a feature
you want, someone has already built a custom ROM for it.
o 2. Infrared Transmission
o The Android operating system supports a built-in infrared transmitter that allows you to use your
phone or tablet as a remote control.
o 3. Automation
o The Tasker app allows control of app permissions and also automates them.
o 7. Widgets
o Apps are versatile, but sometimes you want information at a glance instead of having to open an
app and wait for it to load. Android widgets let you display just about any feature you choose on
the home screen, including weather apps, music widgets, or productivity tools that helpfully
remind you of upcoming meetings or approaching deadlines.
Android devices support NFC, which allows electronic devices to interact across short distances
easily. The main goal here is to create a payment option that is simpler than carrying cash or
credit cards, and while the market hasn't exploded as many experts had predicted, there may be
an alternative in the works, in the form of Bluetooth Low Energy (BLE).
We considered every one of the elements on which Android is better as thought about than different
platforms. Below are some important advantages of Android OS, such as:
o Android Google Developer: The greatest favourable position of Android is Google. Google
claims an android operating system. Google is a standout amongst the most trusted and
rumoured item on the web. The name Google gives trust to the clients to purchase Android
gadgets.
o Android Users: Android is the most utilized versatile operating system. More than a billion
individuals clients utilize it. Android is likewise the quickest developing operating system in the
world. Various clients increment the number of applications and programming under the name of
Android.
o Android Multitasking: The vast majority of us admire this component of Android. Clients can do
heaps of undertakings on the double. Clients can open a few applications on the double and
oversee them very. Android has incredible UI, which makes it simple for clients to do multitasking.
o Google Play Store App: The best part of Android is the accessibility of many applications.
Google Play store is accounted for as the world's largest mobile store. It has practically everything
from motion pictures to amusements and significantly more. These things can be effortlessly
downloaded and gotten to through an Android phone.
o Android Notification and Easy Access: Without much of a stretch, one can access their notice of
any SMS, messages, or approaches their home screen or the notice board of the android phone.
The client can view all the notifications on the top bar. Its UI makes it simple for the client to view
more than 5 Android notices immediately.
o Android Widget: Android operating system has a lot of widgets. This gadget improves the client
encounter much and helps in doing multitasking. You can include any gadget relying on the
component you need on your home screen. You can see warnings, messages, and a great deal
more use without opening applications.
We know that the Android operating system has a considerable measure of interest for users nowadays.
But at the same time, it most likely has a few weaknesses. Below are the following disadvantages of the
android operating system, such as:
o Android Advertisement pop-ups: Applications are openly accessible in the Google play store.
Yet, these applications begin demonstrating tons of advertisements on the notification bar and
over the application. This promotion is extremely difficult and makes a massive issue in dealing
with your Android phone.
o Android require Gmail ID: You can't get to an Android gadget without your email ID or
password. Google ID is exceptionally valuable in opening Android phone bolts as well.
o Android Battery Drain: Android handset is considered a standout amongst the most battery
devouring operating systems. In the android operating system, many processes are running out
of sight, which brings about the draining of the battery. It is difficult to stop these applications as
the lion's share of them is system applications.
o Android Malware/Virus/Security: Android gadget is not viewed as protected when contrasted
with different applications. Hackers continue attempting to take your data. It is anything but
difficult to target any Android phone, and each day millions of attempts are done on Android
phones.
Android versions, name, and API level
Code name Version numbers API level Release date
Android officially publish its Android version 1.0 in September 2008. It is the initial version of Android
operating system. It supports Web browser to show HTML and XHTML web pages, camera, access web
email server (POP3, IMAP4, and SMTP). This version contains Google Calendar, Google Maps, Google
Sync, Google Search, Google Talk, Instant messaging, Media player, Notifications appear in the status bar,
wallpaper, YouTube video player, Alarm Clock, Calculator, Dialer, Pictures (Gallery), Wi-Fi and Bluetooth
support.
On April 27, 2009, the Android updated to 1.5 with the codename of the dessert item (Cupcake). It
has Linux kernel 2.6.27. It supports third-party virtual keyboard, Video recording and playback in MPEG-4,
Copy and paste feature, Animated screen translations, auto-rotation option, ability to upload a video to
YouTube, upload photos to Picasa, check phone usage history.
On September 15, 2009, Android 1.6 was released with the name Donut. It contains numerous new
features such as voice and text entry search, bookmark history, contacts, web, "speak" a string of text,
faster camera access, user can select multiple photos for deletion, support text-to-speech engine, WVGA
screen resolutions.
On October 26, 2009, Android 2.0 was released, whose codename was Eclair. It was based on Linux kernel
2.6.29. It contains the several new features as expanded account sync, Microsoft Exchange email support,
Bluetooth 2.1, ability to tap a Contact photo and select to call, SMS, ability to search all saved
SMS, MMS messages, delete the oldest message automatically when the defined limit is reached, Minor
API, bug fixes.
On December 6, 2010, the Android 2.3 (Gingerbread) was released based on Linux kernel 2.6.35. It
includes the following changes: support for extra-large screen size and resolutions, updated user interface
design with increased simplicity and speed, enhanced copy/paste functionality, select a word by press-
holding, support Near Field Communication (NFC), headphone virtualization, new Download Manager.
It has improved bug fixes for Nexus S, voice or video chat using Google Talk, network performance for
Nexus S 4G, Gmail application, battery efficiency, fixed a voice search bug, Google Wallet support for
Nexus S 4G.
On February 22, 2011, Android 3.0 (Honeycomb) was launched for the first tablet for Android-based on
Linux kernel 2.6.36. It contains the features like "holographic" user interface for tablet, added system Bar,
simplified multitasking tapping Recent Application in system Bar, redesign the keyboard making fast
typing, quick access to camera exposure, hardware acceleration, support for multi-core processor, UI
refinements, connectivity for USB accessories, support for joysticks and gamepads, high-performance Wi-
Fi lock, improved hardware support, Google Books, fixed data connectivity issues when coming out of
Airplane mode.
Android 5.0 "Lollipop" was initially named "Android L" on June 25, 2014. It was officially introduced on
November 12, 2014. Lollipop provides several features like redesigned user interface, support for 64-bit
CPUs, support for print previews, material design, Project Volta for battery life improvement, multiple user
accounts, audio input, and output through USB devices, join Wi-Fi networks, support for multiple SIM
cards, device protection, high-definition voice calls, native Wi-Fi calling support.
Android 6.0 "Marshmallow" was disclosed under the codename "Android M" on May 28, 2015, for Nexus 5
and Nexus 6 phones, Nexus 9 tablet.
Architecture of Android OS
The android architecture contains a different number of components to support any android device
needs. Android software contains an open-source Linux Kernel with many C/C++ libraries exposed
through application framework services.
Among all the components, Linux Kernel provides the main operating system functions to Smartphone
and Dalvik Virtual Machine (DVM) to provide a platform for running an android application. An android
operating system is a stack of software components roughly divided into five sections and four main
layers, as shown in the below architecture diagram.
o Applications
o Application Framework
o Android Runtime
o Platform Libraries
o Linux Kernel
1. Applications
An application is the top layer of the android architecture. The pre-installed applications like camera,
gallery, home, contacts, etc., and third-party applications downloaded from the play store like games, chat
applications, etc., will be installed on this layer.
It runs within the Android run time with the help of the classes and services provided by the application
framework.
2. Application framework
Application Framework provides several important classes used to create an Android application. It
provides a generic abstraction for hardware access and 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, such as activity manager, notification manager, view system,
package manager etc., which are helpful for the development of our application according to the
prerequisite.
The Application Framework layer provides many higher-level services to applications in the form of Java
classes. Application developers are allowed to make use of these services in their applications. The
Android framework includes the following key services:
o Activity Manager: Controls all aspects of the application lifecycle and activity stack.
o Content Providers: Allows applications to publish and share data with other applications.
o Resource Manager: Provides access to non-code embedded resources such as strings, colour
settings and user interface layouts.
o Notifications Manager: Allows applications to display alerts and notifications to the user.
o View System: An extensible set of views used to create application user interfaces.
3. Application runtime
ndroid Runtime environment contains components like core libraries and the Dalvik virtual machine
(DVM). 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
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.
4. Platform libraries
The Platform Libraries include various C/C++ core libraries and Java-based libraries such as Media,
Graphics, Surface Manager, OpenGL, etc., to support Android development.
o app: Provides access to the application model and is the cornerstone of all Android applications.
o content: Facilitates content access, publishing and messaging between applications and
application components.
o database: Used to access data published by content providers and includes SQLite database,
management classes.
o OpenGL: A Java interface to the OpenGL ES 3D graphics rendering API.
o os: Provides applications with access to standard operating system services, including messages,
system services and inter-process communication.
o text: Used to render and manipulate text on a device display.
o view: The fundamental building blocks of application user interfaces.
o widget: A rich collection of pre-built user interface components such as buttons, labels, list views,
layout managers, radio buttons etc.
o WebKit: A set of classes intended to allow web-browsing capabilities to be built into applications.
o media: Media library provides support to play and record an audio and video format.
o surface manager: It is responsible for managing access to the display subsystem.
o SQLite: It provides database support, and FreeType provides font support.
o SSL: Secure Sockets Layer is a security technology to establish an encrypted link between a web
server and a web browser.
5. Linux Kernel
Linux Kernel is the heart of the android architecture. It manages all the available drivers such as display,
camera, Bluetooth, audio, memory, etc., required during the runtime.
The Linux Kernel will provide an abstraction layer between the device hardware and the other android
architecture components. It is responsible for the management of memory, power, devices etc. The
features of the Linux kernel are:
o Security: The Linux kernel handles the security between the application and the system.
o Memory Management: It efficiently handles memory management, thereby providing the
freedom to develop our apps.
o Process Management: It manages the process well, allocates resources to processes whenever
they need them.
o Network Stack: It effectively handles network communication.
o Driver Model: It ensures that the application works properly on the device and hardware
manufacturers responsible for building their drivers into the Linux build.
Android Applications
Android applications are usually developed in the Java language using the Android Software
Development Kit. Once developed, Android applications can be packaged easily and sold out either
through a store such as Google Play, SlideME, Opera Mobile Store, Mobango, F-droid or the Amazon
Appstore.
Android powers hundreds of millions of mobile devices in more than 190 countries around the world. It's
the largest installed base of any mobile platform and growing fast. Every day more than 1 million new
Android devices are activated worldwide.
Android supports java, c++, c# etc. language to develop android applications. Java is the officially
supported language for android. All the android examples of this site is developed using Java language
and Eclipse IDE.
Here, we are going to tell you, the required softwares to develop android applications using Eclipse IDE.
1. By ADT Bundle
2. By Setup Eclipse Manually
By Android Studio
It is the simplest technique to install required software for android application. It includes:
o Eclipse IDE
o Android SDK
o Eclipse Plugin
o If you download the Android Studio from android site, you don't need to have eclipse IDE,
android SDK and eclipse Plugin because it is already included in Android Studio.
o If you have downloaded the Android Studio, unjar it, go to eclipse IDE and start the eclipse by
clicking on the eclipse icon. You don't need to do any extra steps here.
Android Core Building Blocks
An android component is simply a piece of code that has a well defined life cycle e.g. Activity, Receiver,
Service etc.
The core building blocks or fundamental components of android are activities, views, intents, services,
content providers, fragments and AndroidManifest.xml.
Activity
View
A view is the UI element such as button, label, text field etc. Anything that you see is a view.
intent
Service
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.
Content Provider
Fragment
Fragments are like parts of activity. An activity can display one or more fragments on the screen
at the same time.
AndroidManifest.xml
It contains informations about activities, content providers, permissions etc. It is like the
web.xml file in Java EE.
Android Emulator
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.
It is used to test the android application without the need for mobile or tablet etc. It can be created in
different configurations to emulate different types of real devices.
Now an android project has been created. You can explore the android project and see the simple
program, it looks like this:
2) Write the message
File: activity_main.xml
Android studio auto generates code for activity_main.xml file. You may edit this file according to your
requirement.
File: MainActivity.java
1. package first.javatpoint.com.welcome;
2.
3. import android.support.v7.app.AppCompatActivity;
4. import android.os.Bundle;
5.
6. public class MainActivity extends AppCompatActivity {
7. @Override
8. protected void onCreate(Bundle savedInstanceState) {
9. super.onCreate(savedInstanceState);
10. setContentView(R.layout.activity_main);
11. }
12. }
To run the android application, click the run icon on the toolbar or simply press Shift + F10.
The android emulator might take 2 or 3 minutes to boot. So please have patience. After booting the
emulator, the android studio installs the application and launches the activity. You will see something like
this:
Output:
ou