You are on page 1of 32

Mobile Programming

CHAPTER TWO
BASIC OF ANDROID DEVELOPMENT
Table of Content
2

Introduction to Android programming


Why develop for android
Evolutions of Android OS
Android OS architecture
Introduction to Android programming
3

Android is an :
 open source and Linux-based operating System for mobile devices
 developed by the Open Handset Alliance, led by Google, and other
companies.
 unified approach to application development which means
developers need only develop for Android, and their applications
should be able to run on different devices powered by Android.
 A software stack for mobile devices
 Android SDK for creating apps Libraries & development tools
Why Android programming ?
4

Market share
Time to market
Open platform
Cross-compatibility
Mashup capability
…..why android
5

1. Market share
 you have an opportunity to develop apps for a fairly
new market that is booming on a daily basis.
 The Android Market puts your app right into your
users’ hands easily!
2. Time to market
 all the application programming interfaces (APIs)
that Android comes packed with
 it’s easy to develop full-featured applications in a
relatively short time frame
…… why android
6

3. Open platform
 The Android operating system is open platform, meaning that it’s
not tied to one hardware manufacturer and/or one provider.
 openness of Android is allowing it to gain market share quickly.
All hardware manufacturers and providers can make and sell
Android devices.

4.Cross-compatibility
 Android can run on many devices with different screen sizes and
resolutions. Besides being cross-compatible, Android comes with
the tools that help you develop cross-compatible applications
7
Mashup capability

 A mashup combines two or more services to create


an application.
 You can create a mashup by using the camera and
Android’s location services,
 for example, to take a picture with the exact location
displayed on the image!
 It’s easy to make a ton of apps by combining services
or libraries in new and exciting ways.
 You can use a maps API with the contact list to show
all your contacts on a map
…example mashup
8

Here are a few other mashups


 Geolocation and social networking
 Geolocation and gaming
 Contacts and Internet
Features of Android
9

 Beautiful UI
 Connectivity
 Storage SQLite, a lightweight Relational Database
 Media support
 Messaging SMS and MMS
 Web browser
 Multi-touch
 Multi-tasking
 Resizable widgets
 Multi-Language
 Wi-Fi Direct …
Evolutions of Android OS
Evolutions of Android OS
11
Currently :
 popular mobile platform
 largest installed base of any mobile platform
 growing fast every day
Android’s popularity is :
 associated with hardware diversity (the number of devices
using the OS),
 innovation, open-source/free market system,

 powerful development framework,


 strong developer community, and plenty of killer applications.
Market share mobile operating system
12
………….
13
Android versions
14

 Android 1.0 - September 2008 popular mobile platform


 the first commercial version with the HTC Dream as the first
Android phone in the world(Angle Cake)
Android 1.1 - February 2009 (BattenBerg)
……………..
………………

Android 4.2 - Jelly Bean: November 2012


Android 4.3 – Jelly Bean: July 2013
Android 4.4 – KitKat: October 2013
Android OS architecture
Android OS architecture
16

Android OS :
 different software layers arranged in stack
 each layer provides different services to the layer above it.
 Put together, it will make the OS, middleware and applications.
Components of android OS
 Application layer
 Application framework
 Android runtime
 Libraries
 Linux kernel
Android OS architecture ….
17
Linux Kernel
18

Android OS is built on top of the Linux Kernel


Android is built on top of Linux 2.6 Kernel with architectural
changes made by Google
 It doesn’t mean it’s another Linux distribution. It simply
means, Android at its core is Linux!
 The Linux kernel acts as an abstraction layer between the
hardware and other software layers
 Linux Kernel provides the basic system functionality
such as process management, memory management and device
management
 Linux kernel provides array of device drivers (Example:
Bluetooth driver)
Linux Kernel… standard service
19

Security
Memory & process management
File & network I/O
Device drivers
Linux Kernel… Android specific service
20

Power management
Android shared memory
Low memory killer
Interprocess communication
And much more
Libraries
21

This layer enables the device to handle different types of


data
 Useful for well functioning of android operating system
 Java libraries build specific for android operating system
 Some important libraries
 Surface manager: provides display management
 Media framework: to provide different media codecs which allow the
recording and playback of different media formats
 SQLite: the database engine used in android for data storage purposes
 SSL: to provide internet security
 Graphics: to provide Java interface for 2D & 3D graphics
 WebKit: the browser engine used to display Internet/HTML content
Libraries
22
Android runtime
23
Consists of :
 Dalvik Virtual machine
 Core Java libraries
 Dalvik Virtual Machine (kind of Java Virtual
Machine specially designed and optimized for Android)
 Type of JVM designed for Android devices
 a bytecode interpreter which is highly optimized for executing on the
mobile platform
 The bytecodes are converted Java binaries that are very quick and efficient
to run on low processing power and low memory environments
 allows multiple instance of Virtual machine to be created simultaneously
providing security, isolation, memory management and threading support
 core functions of Linux
Core Java libraries
24

basic java classes -- java.*, javax.*


app lifecycle -- android.*
Internet/Web services -- org. *
Unit testing -- junit.*
Application framework
25

Provides all of the major APIs that applications can


directly interact with
 Manages the basic functions of the android device such as
resource management, voice call management, data
sharing, receiving notifications etc…
Important blocks of application framework
 Activity Manager: Manages the activity life cycle of applications
 Content Providers: Manage data sharing between applications
 Telephony Manager: Manages voice calls
 Location Manager: Location management, using GPS or cell tower
 Resource Manager: Manage the various types of resources used in
our android app
Applications
26

Top layer in the Android architecture


Applications are either native or third-party
Native applications come pre-installed with every
device. Example:
 SMS client app
 Dialer
 Web browser
 Contact manager etc…
Applications created by third party users or
developer are also installed on application layer
Application components
27

the essential building blocks of an Android


application
Each component is a different point through which
the system can enter your app
……loosely coupled components
bound by an application manifest
that describes each component and how they all
interact
as well as the application metadata including its
hardware and platform requirements.
…….
28

Not all components are actual entry points for the


user
some depend on each other,
but each one exists as its own entity and plays a
specific role
each one is a unique building block that helps define
your app's overall behavior
Types …..
29

Activity application component


 are the presentation layer of the application.
 Every screen in any application will be an extension of the
Activity class.
 Single user interface
Service application component
 are the invisible components of your application that run in the
background,
 that runs in the background to perform long-running operations
 triggering Notifications.
 to perform work for remote processes
Types …..
30

Content provider application component


 are shareable data stores that are used to manage and share
application databases.
 They’re the preferred means of sharing data across application
boundaries.
Broadcast receiver application component
 simply respond to broadcast messages from other applications
or from the system itself.
 These messages are sometime called events or intents.
Additional components….
31

Intents application component


 are inter-application message-passing framework that can
broadcast messages system-wide or
 to a target Activity or Service
Fragment application component
 represents a behavior or a portion of user interface in an
Activity.
 It enables more modular activity design.
 Is a kind of sub-activity
Conclusion and question
32

Introduction to Android programming


Why android
Android OS Architecture

Any questions ?

You might also like