Android Notes-Unit 1 Final

Download as pdf or txt
Download as pdf or txt
You are on page 1of 16

Definition

It is a Linux based open source Operating System which was initially designed for
mobile phones. Nowadays it has expanded its functionality to a large variety of devices
ranging from mobile phones, tablets, mini computers to a wide range of other devices such
as wearable computing devices (smart watches, health bands, …), smart home appliances
(smart TV, AC, refrigerators, washing machines, …), vehicle management systems (android
auto) It is a stack of softwares, among which some are operating system application, some
are middleware application and others are key/user application softwares. It is an open source
technology that allows the software to be freely modified and distributed by device manufacturers,
wireless carriers and developers.

Android Logo
Android logo is a green colored robot. It was designed by a designer of Google Inc. Irina Blok.
It was also known as open source project so that anyone can modify and use the logo. The design of
the Android logo is based on the popular washroom logos and a robot image.

Android History
Android Inc. was founded in Palo Alto of California, U.S. by Andy Rubin, Rich Miner, Nick Sears
and Chris White during 2003 aiming to develop operating system for Digital Cameras. Later on due to
the declining market of the digital cameras they changed their aim to develop operating system for
mobile phones. Google Inc. acquired Android Inc. in 2005. In 2007, Apple released its first iPhone with
iOS. In the same year, Google formed a business alliance with 47 companies called OHA (Open Handset
Alliance) aimed at the creation of a standard open platform for mobile devices. The members of OHA
include handset manufacturers (Motorola, HTC), chip makers (Qualcomm, Texas Instruments),
commercialization companies, software companies and network operators (T - mobile). Since its
inception, Android Inc. has travelled a long distance from its first version, Android 1.0, in 2007 to
Android 12.0 (Snowcone) in 2021.
Android Versions
1. Android 1.0(Alpha,Petit four)

Features: YouTube, wi-fi, Bluetooth.


2. Android 1.5(Cupcake)
Features: mpeg4,3GP,homescreen is populated with widgets, animated screen
transition.
3. Android 1.6(Donut)
Features: WVGA(Wide video Graphics Array),improved search experience.
4. Android 2.0(Eclair)
Features: Flash support, scene mode, digital zoom, colour effect, improved
typing speed, smart dictionary that learns from word usage.
5. Android 2.2(Froyo)
Features: V8 JavaScript engine, integrate chrome, adobe flash, voice dialling,
contact sharing through Bluetooth, USB tethering, speed boost up by JIT
compiler.
6. Android 2.3(Ginger Bread)
Features: Copy paste feature, webM&AAC (advanced audio
communication),supports NFC(near field communication).
7. Android3.0(Honey Comb)
Features: Specially designed for tablets, introduced with Motorola zoom,
support multitasking, support multiprocessor, hardware acceleration.
8. Android 4.0(Ice Cream Sandwitch)
Features: HD support.
9. Android 4.1(Jelly Bean)
Features: Triple buffering, automatically resizable, app widgets, multichannel
sound.
10. Android 4.4(KitKat)
Features: Ok google, cloud storage integration, print otg, runs on low memory
device, immersive mode.
11. Android 5.0(Lollipop)
Features: Screenpinning, multiuser or multi login, trusted device unlock,
power saver.
12. Android 6.0(Marshmellow)
Features: Text selection floating window, native fingerprint support, USB type
c support, USB 3.1 support, app and system auto backup.
13.Android 7.0(Nougat)
Features: Split screen, data saver.
14. Android 8.0(Oreo)
Features: PIP(Picture in Picture),notification dots, password autofield, new
emojis, smart text selection window.
15. Android 9.0(Pie)
Features: Adaptive battery and brightness, improved security.
16. Android 10(Quince Tart)
Features: Smart reply, sound amplification, dark theme, gesture navigation.
17.Android 11(Red Velvet Cake)
Features: Improved privacy and security features.
18. Android 12(Snow Cone)
Features:Extra long screenshot, extra dim option, screen shrink option, face
navigation, advanced game option, enhanced overview.

Why Android?
● Browser
● Connectivity(wi-fi, Bluetooth, mobile n/w, GPS,NFC,IR)
● Desktop
● Multinotification
● Endless personalization
● Market
● Google integration
● Open source
● Open to carrier
● Future

Features of Android
● Open source: Entire code including the kernel is open to public.
● Database: SQLite (an offline database is used in android).It is a
lightweight opensource RDBMS meant to run on a smartphone.
● Media support: It supports mp4,3GP,webM. Android runs all popular
video, audio and image formats.
● Media streaming support: It supports RTP/RTSP, progressive HTML
streaming, adobe flash streaming, HTTP dynamic streaming.
● Multitouch
● Efficient web browser
● Multitasking support
● Accessibility: Text to speech, voice dialing, voice texting, voice
navigation, face navigation, gesture navigation etc.
● Voice based services: Voice dialing, voice texting, voice navigation etc.
● Extra storage: ROM, micro SD card, USB flash drive, USB HDD.

Stakeholders of Android

● Google Inc
● Original equipment manager
● Android application development companies
● Freelance developers
Android Architecture

Android can be referred to as a software stack of different layers


where every layer is a group of several program components among which
some are operating system components, some are middleware and rest are
key applications (user applications).
In android Operating System, program components are organized in the
following layers.
1. Application Layer
2. Application Framework Layer
3. Library Layer
a)Android Runtime Environment (ARE)
4. Linux Kernel
1. Application Layer: where user applications are running. This layer
directly interacts with the user. This layer contains many preinstalled
apps (phone, contacts, message, browser, calculator etc) and many
other user apps installed later from Playstore.

2. Application Framework Layer: This layer consists of many program


components which helps the user to create different android apps and
run various android app. This layer consists of the following
programming components.

i. Activity manager: It manages the various lifecycle states of an


activity window (Create, Start, Resume, Pause, Stope, Restart and
Destroy) and thereby acts as a common navigation back stack.
ii. Window manager: It deals all window related tasks such as
window orientation.
iii. View system: The various visible elements in an activity window
such as image view, text view, button view etc. Android has a rich
and extensible set of view system to create an efficient android
application.
iv. Resource manager: Used to access non code resources such as
localized strings, graphics and layout files.
v. Content provider: Used to accept the data from other apps (which
is shared to access) also it allows an app to share its own data to
other apps.
vi. Package manager: It is responsible for all types of packaging
activities in the app.
vii. Notification manager: It enables all app to create their custom
alerts in the status bar.
viii. Location manager: It does all location related operations,
nowadays many android apps highly demand the device location
(Maps, GPS etc.)
ix. Telephony manager: Perform all voice call and message(SMS).
x. XMPP Manager (Extensible Message and Presence Protocol):
XMPP is used for instant messaging.

3. Library Layer: This layer includes basic libraries used for various
android applications capabilities. Some of them are listed below.
i. Media framework library: It is responsible for the playback of
various multimedia contents (video, audio, images) in the app.
ii. SQLite: Used to run SQLite RDBMS in the app.
iii. Webkit library: It is necessary for the proper working of the
android browser, it enables the following features to the browser
app-HTML-5, CSS, JavaScript, jQuery, Ajax and many more
capabilities.
iv. OpenGL: It manages 3D images.
v. SGL (Scalable Graphics Library): Used for low level image
processing.
vi. SSL (Secure Socket Layer): It is a security enhancement to the
android since many apps perform online banking and other
financial operations. SSL ensures data integrity, authenticity,
illegal access prevention & data privacy.
vii. Lib C: Used to run c code in android.
viii. Surface manager: It is the library responsible for all the window
surfaces rendered by various components in an activity window.
ix. Freetype:It is used to manage all font operations.

Android Runtime Environment(ARE)


Since most of the Android applications and framework APIs are written
in java language. Android system must include a JVM inside, as you know
mobile phones are really low resource devices (in terms of processing
capability, memory, battery power etc.),a fully-fledged JVM is a burden for a
phone, in this regard DVM (Dalvik Virtual Machine) is introduced in mobile
phone instead of a JVM. DVM is a light weight JVM highly optimized for low
resources devices such a mobile phone. DVM can perform efficiently, memory
management, security, isolation, multithreading etc. just like a JVM does.
DVM does not run .class file instead it runs .dex (Dalvik executable). In
Android the Dalvik compiler compiles all .class files into single .dex file. This
.dex file is then executed by the DVM and produces the output.
ARE consists of 2 components;
1. Core libraries
2. DVM

Core library mainly used to manage:


● Data structure operations
● File access operations
● Network access
● Utilities
● Graphics
4. Linux kernel layer
This is the bottom layer in the Android architecture. Usually, it has various
hardware device drivers used to manage and drive different hardware
connected to the phone such as display unit, camera unit, microphone,
speaker system, Bluetooth wi-fi and mobile network, transceivers unit,
fingerprint sensor unit, battery unit etc.
This layer usually has the following drivers:
1. Display driver
2. Camera driver
3. Keypad driver
4. Audio driver
5. Wi-fi driver
6. Bluetooth driver
7. USB driver
8. Flash memory driver
9. Power management (battery unit) driver
10.Binder (IPC- Inter Process Communication ) driver

Note: In Android architecture most of the software components in application


and application framework layer are written in java language.
Most of the libraries in library layer are written in C & C++.
Various hardware drivers in Linux kernel layer are also written in C, C++ and
Objective C.
We use Java Native Interfaces (JNI) to connect to a C or C++ component

Android Software Development Kit( Android SDK)


It is the necessary software which must be installed on your computer to
develop an android application. It helps the android developer to create(build),
compile, test, debug and deploy an android application. Usually it has
important API (Application Programming Interface) libraries, and emulators (to
create Android Virtual Devices or AVDs to test the application),
documentation, sample code, tutorials, developer tools and the editor to write
the program.

Features of SDK
1. No licensing, distribution, development
2. Wi-fi hardware access
3. It supports GSM, CDMA, EDGE, 3G, 4G for the telephony and data
transfer
4. comprehensive APIs for GPS, google map(location based services)etc.
5. Full multimedia hardware control
6. APIs for accelerometer and compass hardware
7. IPC Instant Message Passing
8. Shared data store
9. Integrated open source Webkit based browser
10.Peer-to-Peer (P2P) communication using google talk
11.2D, 3D graphics support
12.It has efficient set of multimedia libraries to playback and record various
multimedia files (video, audio & image)
13.It supports content provider framework to share the component of one
app to another

GSM-Global System for Mobiles


CDMA-Code Division Multiple Access
EDGE-Extended Data rate GSM Evaluation

Android Development Tool (ADT)


It is nothing but a plug in software, which can be added to the popular Eclipse
IDE, which creates the environment to develop an android application using
Eclipse. Using Eclipse and ADT an android developer can create (build),
compile, test, debug and deploy an android application.

ADT bundle
1. Eclipse + ADT plug in
2. Android SDK tools
3. Android platform tools
4. Most recent android platform
5. Newest android system image

Android Virtual Device (AVD)


An AVD is an emulator configuration that enables to model an actual device by
calling hardware and software options to be emulated by the android
emulator.
In other words, an AVD is an emulator occurrence that enables to create
a real physical device virtually in order to test an android application without
using a physical mobile device.

Usually an AVD consists of the following components:


● Emulator skin used to control the dimensions of the device, it’s look and
so on.
● A hardware sketch/ hardware profile specifies the hardware
configuration for the AVD such as the processor capabilities it’s memory
specifications, whether is has a camera, a QWERTY keypad or dialling
keypad or not.
● A mapping or a connection to an android system image: it specifies
which version of the android OS will run on your AVD
● An emulated SD (Secure Digital) card for the extended memory
Note: A dedicated , storage area in the hard disk of your development machine
is highly required for the AVD to store the device user’s data( data of the
applications, settings etc.) and to create an emulated SD card.

Q: How to create an AVD in Android studio?


Ans: using the option AVD manager- which helps to create and manage AVDs.

Note: in order to test an android application, make at least three virtual


devices. One with correct API, one with a lower API – to test the backward
compatibility and third one with a higher API version – to test the forward
compatibility of the app.

Emulators
Emulators are an important software component of the android SDK to test an
android app by creating virtual devices. Actually the emulator mimics all
hardware and software capabilities of a physical mobile device except it cannot
place actual phone calls, since it does not have a real SIM inside.
● Emulator has a display in which our android app is displayed
● Emulator, has a selection of navigation and control keys, which can be
pressed using mouse or keyboard to create various events for our
application
● Emulator runs on full android system stack down to the kernel layer.
Including a set of Preinstalled apps (phone, message, camera, browser
etc.) that can be accessed by your application
● Emulator performs dynamic binary translation of the device machine
code for the host Operating System and processor architecture of the
android Development Machine.

Emulator Contains:
1. Multiple keypad / Dialing pad.
2. Sound chip. (input & output capabilities)
3. An ARMV5 CPU and the corresponding memory management unit
(MMU)
4. A 16-bit LCD display
5. one or more keyboards (a QWERTY -based keyboard and associated
Dialing pad (phone buttons)
6. A sound chip among output and input capabilities
7. Flash memory partitions (emulated through disk image files on the
development machine)
8. GSM modem, including a simulated SIM card
9. A camera, using a webcam connected to our development computer.
10.Sensors like an accelerometer, using records from a USB connected
Android device.

DVM
● Dan Bornstein (a google engineer) designed & wrote the DVM

● Dalvik is a name of a town in Iceland

● It is a lightweight JVM

● It is highly optimized for low resource devices such as mobile phones


&other handheld devices
● does not run .class files (byte code files) instead it runs .dex (Dalvik
bytecode files)files (dex : dalvik executable)

● Dalvik compiler (dex compiler) it receives multiple .class files & compiles
it into a single .dex file.

● .dex is executed by the DVM

● AAPT (Android Asset Packaging Tool) adds sufficient resources and


assets to the ∙dex file and thereby creating .apk file (Android application
Package) for the android app deployment (distribution) and installation.

● apk file is comparatively small in size by around of 50% of its


corresponding jar (java archive) by reusing duplicate information from
numerous class files.

● DVM uses a different assembly code generation in which registers act as


the primary data Storage units instead of memory stack. It would
definitely reduces the instructions in assembly Code by 30%

● DVM uses a fine tuned Garbage collection


JVM DVM
JVM supports multiple Operating DVM supports only Android
System. Operating System.
It compiles Java Bytecode. It compiles Dalvik Bytecode.
It forms separate classes in separate It forms multiple classes in one .dex
.class byte code file. byte code file.
JVM is based on Stack based virtual DVM is based on register based
machine architecture virtual machine architecture
It runs on more memory. It runs on less memory.

The executable format of JVM is JAR The executable format of DVM is APK
(one or more .class files) (only one .dex file)
JVM runs .class byte code directly. The .class byte codes are optimized
to .dex format before executing in
DVM
A Simple Android Programme
Activity File (JAVA File – MainActivity.java)

package com.example.activitylifecycles;

import androidx.appcompat.app.AppCompatActivity;

import android.os.Bundle;
import android.util.Log;

public class MainActivity extends AppCompatActivity


{

protected void onCreate(Bundle savedInstanceState)


{
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
}
}

Layout File (XML File - activity_main.xml)


<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent">
<TextView android:layout_width="match_parent"
android:layout_height="wrap_content"
android:text="GOD is Love"/>

</LinearLayout>

You might also like