Android Unit I MMD

Download as pptx, pdf, or txt
Download as pptx, pdf, or txt
You are on page 1of 88

An

dr
oi d
INTRODUCTION
 Android's mobile operating
system is based on the Linux
kernel and is the world's best-
selling Smartphone.
 There are currently over
200,000 apps available for
Android that are made
accessible through the
Android Market, which is the
online app store run by
Google.
 The apps are primarily written
in Java.
BACKGROUND
Android Inc. was founded in Palo
Alto, California in October, 2003 by
Andy Rubin, Rich Miner, Nick Sears,
and Chris White.
Their goal was to develop a
"smarter mobile device that was
more aware of its owner's location
and preferences.”
They operated secretively,
admitting only that they were
working on software for mobile
phones.
BACKGROUND
 On October 21st, 2008, Android
1.0 became available to the
public.
 "Today's announcement is more
ambitious than any single
'Google Phone' that the press
has been speculating about over
the past few weeks. Our vision is
that the powerful platform we're
unveiling will power thousands
of different phone models.“
-Eric Schmidt, former Google
Chairman/CEO
Android Introduction
Platform Overview

5
What is Android?

 Android is called as “the first complete,


open, and free mobile platform”:
 Complete: allows for rich application
development opportunities.
 Open: It is provided through open-
source licensing.
 Free: Android applications are free to
develop. Android applications can be
 distributed and commercialized in a
variety of ways.

6
7
THE ANDROID VERSION
Android 1.0 Alpha
Android 1.1 Beta
Android Cupcake
Android Donut
Android Eclair
Android Froyo
Android Gingerbread
Android Honeycomb
Android Ice Cream Sandwich
Android Jelly Bean
Android KitKat
Android Lollipop
Android Marshmallow
Android Nougat
Android Oreo
Android Pie
Android 10
Android 11
Android 12
Android 12L
Android 13
Android 14

8
OHA (Open Handset Alliance)
A business alliance consisting of 47
companies to develop open standards
for mobile devices

9
Phones

HTC G1,
Droid, Motorola Droid (X)
Tattoo

Suno S880 Samsung Galaxy Sony Ericsson

10
Tablets

Velocity Micro Cruz Gome FlyTouch Acer beTouch

Toshiba Android Cisco Android Tablet


Dawa D7 SmartBook

11
Features of Android

 Free and Open Source


 Familiar and inexpensive development tools
 Freely available SDK
 Familiar Language, Familiar Development Environments
 Reasonable learning curve for developers
 Enabling development of powerful applications
 Rich, secure application integration
 No costly obstacles to publication
 Free “Market” for application
 A new growing platform
What it is not?
Android is not:
 A Java ME implementation: Android applications are written in the Java
language, but they are not run within a Java ME virtual machine, and Java-
compiled classes and executable will not run natively in Android.
 Part of the Linux Phone Standards Forum or the Open Mobile Alliance: Android
runs on an open-source Linux kernel, but, while their goals are similar,
Android’s complete software stack approach goes further than the focus of
these standards-defining organizations.
 Simply an application layer (like UIQ or S60): While Android does include an
application layer, ‘‘Android’’ also describes the entire software stack
encompassing the underlying operating system, the API libraries, and the
applications themselves.
 A mobile phone handset Android includes a reference design for mobile
handset manufacturers, but there is no single ‘‘Android phone.’’ Instead,
Android has been designed to support many alternative hardware devices.
 Google’s answer to the iPhone: The iPhone is a fully proprietary hardware and
software platform released by a single company (Apple), while Android is an
open-source software
NATIVE ANDROID APPLICATIONS
Android phones will normally come with a suite of generic preinstalled applications
that are part of the Android Open-Source Project (AOSP), including, but not
necessarily limited to:
• An e-mail client
• An SMS management application
• A full PIM (personal information management) suite including a calendar and
contacts list
• A Web Kit-based web browser
• A music player and picture gallery
• A camera and video recording application
• A calculator
• The home screens
• An alarm clocks
 In many cases Android devices will also ship with the
following proprietary Google mobile applications:
• The Android Market client for downloading third-
party Android applications
• A fully-featured mobile Google Maps application
including Street View, driving
directions and turn-by-turn navigation, satellite view,
and traffic conditions
• The Gmail mail client
• The Google Talk instant-messaging client
• The YouTube video player
ARCHITECTURE

16
17
18
Android S/W Stack - Application

 Android provides a set of core applications:


 Email Client
 SMS Program
 Calendar
 Maps
 Browser
 Contacts
 Etc

 All applications are written using the Java language.

19
20
Android S/W Stack –
App Framework

 Enabling
and simplifying the reuse of
components
 Developers have full access to the same
framework APIs used by the core applications.
 Users are allowed to replace components.

21
Android S/W Stack –
App Framework (Cont)
 Features
Feature Role
View Used to build an application, including lists, grids, text
System boxes, buttons, and embedded web browser
Content Enabling applications to access data from other
Provider applications or to share their own data
Resource Providing access to non-code resources (localized strings,
Manager graphics, and layout files)
Notification Enabling all applications to display customer alerts in the
Manager status bar
Activity Managing the lifecycle of applications and providing
Manager a common navigation backstack
Location Provide access to the location services allowing an
Manager application to receive an updates about location changes

22
Android S/W Stack - Libraries

 Including a set of C/C++ libraries used by


components of the Android system
 Exposed to developers through the Android
application framework

23
24
@2011 Mihail L. Sichitiu 25
26
Android S/W Stack - Runtime

 Core Libraries
 Providing most of the functionality available in
the core libraries of the Java language
 APIs
 Data Structures
 Utilities
 File Access
 Network Access
 Graphics
 Etc 27
Android S/W Stack – Runtime (Cont)
 Dalvik Virtual Machine
 Providing environment on which every Android application runs
 Each Android application runs in its own process, with its own instance of
the Dalvik VM.
 Dalvik has been written such that a device can run multiple VMs efficiently.

 Register-based virtual machine

28
Android S/W Stack – Runtime (Cont)
 Dalvik Virtual Machine (Cont)
 Executing the Dalvik Executable (.dex) format
 .dex format is optimized for minimal memory footprint.
 Compilation

 Relying on the Linux Kernel for:


 Threading
 Low-level memory management

29
30
Android S/W Stack – Linux Kernel

 Relying on Linux Kernel 2.6 for core system services


 Memory and Process Management
 Network Stack
 Driver Model
 Security
 Providing an abstraction layer between the H/W and the rest
of the S/W stack

31
32
33
https://www.javatpoint.com/android-operating-system
Application
Structure
Application Components

Application components are the essential building blocks


of an Android application.

Each component is a different point through which the


system can enter your application.

Here are the four types of application components:



Activities

Services

Content providers

Broadcast receivers
Activities
An activity represents a single screen with a user interface.

Services
A service is a component that runs in the background to perform long-running
operations or to perform work for remote processes. A service does not provide a
user interface.

Content providers
A content provider manages a shared set of application data. You can store the
data in the file system, an SQLite database, on the web, or any other persistent
storage location your application can access. Through the content provider, other
applications can query or even modify the data (if the content provider allows it).

Broadcast receivers
A broadcast receiver is a component that responds to system-wide broadcast
announcements. Many broadcasts originate from the system—for example, a
broadcast announcing that the screen has turned off, the battery is low, or a picture
was captured. Applications can also initiate broadcasts.
Activating Components

A unique aspect of the Android system design is that any


application can start another application’s component.

Three of the four component types—activities, services, and


broadcast receivers—are activated by an asynchronous message
called an intent.
The Manifest File

Your application must declare all its components in this file, which must be at
the root of the application project directory.

The manifest does a number of things in addition to declaring the application's


components, such as:

Identify any user permissions the application requires

Declare the minimum API Level required by the application

Declare hardware and software features used or required by the application

API libraries the application needs to be linked against

And more
Declaring components

The primary task of the manifest is to inform the system about the application's components. For example, a manifest file
can declare an activity as follows:

<?xml version="1.0" encoding="utf-8"?>


<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.test.appstructure"
android:versionCode="1"
android:versionName="1.0">
<uses-sdk android:minSdkVersion="4" />

<application android:icon="@drawable/icon" android:label="@string/app_name">


<activity android:name=".MainActivity"
android:label="@string/app_name">
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
</application>
</manifest>

Activities, services, and content providers that you include in your source but do not declare in the manifest are not visible to
the system and, consequently, can never run.
Application Resources

For every resource that you include in your Android project, the SDK build
tools define a unique integer ID, which you can use to reference the
resource from your application code or from other resources defined in
XML.

One of the most important aspects of providing resources separate from


your source code is the ability for you to provide alternative resources for
different device configurations.
Android Projects
An application project is the main type of project and the contents
are eventually built into an .apk file that you install on a device.
Test Projects
These projects contain code to test your application projects and are
built into applications that run on a device.
Library Projects
These projects contain shareable Android source code and
resources that you can reference in Android projects. Library
projects cannot be installed onto a device, however, they are pulled
into the .apk file at build time.
Contains your stub Activity file, which is stored
at src/your/package/ActivityName.java.

All other source code files (such as .java


or .aidl files) go here as well.
Contains the Java files generated by
ADT, such as your R.java file and
interfaces created from AIDL files.
You can use it to store raw asset files.
Files that you save here are compiled
into an .apk file as-is, and the original
filename is preserved.
Contains private libraries.
Contains application
resources, such as
drawable files, layout files,
and string values
For XML files that are compiled
into animation objects
For XML files that describe colors
For bitmap files (PNG, JPEG, or GIF),
9-Patch image files, and XML files that
describe Drawable shapes or a
Drawable objects that contain multiple
states (normal, pressed, or focused)
XML files that are compiled into
screen layouts (or part of a screen)
For XML files that define application menus
For arbitrary raw asset files. Saving asset
files here instead of in the assets/ directory
only differs in the way that you access them.
These files are processed by aapt and must
be referenced from the application using a
resource identifier in the R class. For
example, this is a good place for media,
such as MP3 or Ogg files.
For XML files that are compiled into many
kinds of resource. Unlike other resources in
the res/ directory, resources written to XML
files in this folder are not referenced by the
file name. Instead, the XML element type
controls how the resources is defined within
them are placed into the R class.
For miscellaneous XML files that configure
application components.
For example, an XML file that defines a
PreferenceScreen, AppWidgetProviderInfo,
or Searchability Metadata.
The control file that describes the nature of the
application and each of its components. For
instance, it describes: certain qualities about the
activities, services, intent receivers, and content
providers; what permissions are requested; what
external libraries are needed; what device features
are required, what API Levels are supported or
required; and others.
This file contains project settings, such as the
build target. This files is integral to the project,
as such, it should be maintained in a Source
Revision Control system. Do not edit the file
manually.
This file defines how ProGuard optimizes and
obfuscates your code
Security

The Android operating system is a multi-user Linux system in which each


application is a different user.

Each process has its own virtual machine (VM), so an application's code runs
in isolation from other applications.

An application can request permission to access device data such as the


user's contacts, SMS messages, the mountable storage (SD card), camera,
Bluetooth, and more.

All application permissions must be granted by the user at install time.


Storage

Where to place your files on SD Card

/Android/data/<package_name>/your_files
Build process

Apk file contents


JVM vs Dalvik
Android build Process steps
• AAPT Tool

• AAPT stands for android assets packaging tool. This tool comes with the Android SDK and present in
$ANDROID_HOME/platform-tools/. It takes all the resources present in the res/ directory and compiles them. It generates a
R.java file which contains ids of all the resources. Once you have installed the Android SDK you can directly execute the
aapt commands.
• Then all the java files including R.java gets compiled into byte code.

• Android application runs on dalvik vm so the byte code is cross compiled to the Dalvik byte code (.dex file)

• The .dex file and the compiled resources together forms the .apk file.

• Generated apk file is a debug build, to make a release build we need to sign the apk file using a key. You can do this from Android
Studio.

• Once you sign the apk file it will be ready to use in production.
Android UI
Resources

You might also like