SlideShare a Scribd company logo
Android – Quick Talk
Apps on the Device 
In the past: 
Today: 
Entertainment purpose 
Substantial purchase criteria
Agenda 
• Mobile Application Development (MAD) 
• Intro to Android platform 
• Platform architecture 
• Application building blocks 
• Development tools 
• Hello Android
Why MAD? (Mobile App Development) 
• The fact that we can! 
• Mobile platform is the platform of the future 
▫ Double-digit growth in world-wide smartphone ownership3 
• Smart Phones 
• Internet access anywhere 
• Social networking 
• Millions of mobile users 
• Open standards 
• Job market is hot 
▫ Market for mobile software surges from $4.1 billion in 2009 to 
$17.5 billion by 20121 
▫ 2010 Dice.com survey: 72% of recruiters looking for iPhone 
app developers, 60% for Android 
• Students (and faculty!) are naturally interested!
Why Android? 
• A lot of students have them 
▫ 2010 survey: 22% of college students have Android phone (26% 
Blackberry, 40% iPhone) 
▫ Gartner survey: Android used on 22.7% of smartphones sold world-wide 
in 2010 (37.6% Symbian, 15.7% iOS) 
• Students already know Java and Eclipse 
▫ Low learning curve 
▫ Students can use App Inventor for Android 
• Transferring app to phone is trivial 
▫ Can distribute by putting it on the web 
▫ Android Market for wider distribution 
• It’s not 1984
Android Phones…
Android Tablets… 
Android Devices
Android-Powered TV
Android-Powered Microwave
Brief History 
• 1996 
▫ The WWW already had websites with color and images, but, the best 
phones displayed a couple of lines of monochrome text! 
▫ Enter: Wireless Application Protocol and Markup Language 
WAP : Stripped down bandwidth reduction 
WML : Stripped down HTML for content 
Many issues (WAP = “Wait And Pay”) 
Few developers to produce content (it wasn’t fun!) 
▫ Really hard to type in URLs using the small keyboards 
▫ Data fees frightfully expensive 
▫ No billing mechanism – content difficult to monetize 
• Other platforms emerged 
▫ Palm OS, Blackberry OS, J2ME, Symbian (Nokia), BREW, OS X 
iPhone, Windows Mobile
Brief History - Android 
• 2005 
▫ Google acquires startup 
Android Inc. to start Android 
platform 
▫ Work on Dalvik VM begins 
• 2007 
▫ Open Handset Alliance 
formed to develop open 
standards for mobile devices 
▫ Early look at SDK 
• 2008 
▫ Google sponsors 1st Android 
Developer Challenge 
▫ T-Mobile G1 announced 
▫ SDK 1.0 released 
▫ Android released open source 
(Apache License) 
▫ Android Dev Phone 1 released 
▫ Android Source code 
Published 
• 2009 
▫ SDK 1.5 (Cupcake) 
New soft keyboard with 
“autocomplete” feature 
▫ SDK 1.6 (Donut) 
Support Wide VGA 
▫ SDK 2.0/2.0.1/2.1 (Eclair) 
Revamped UI, Browser 
• 2010 
▫ Nexus One released to the 
public 
▫ SDK 2.2 (Froyo) 
Flash support, Tethering 
▫ SDK 2.3 (Gingerbread) 
UI update, system-wide 
copy-paste
Brief History - Android 
Honeycomb 
Android 3.0-3.2 
• 2011 
▫ SDK 3.0/3.1/3.2 (Honeycomb) for tablets only 
Ice cream Sandwich 
New UI for tablets, support multi-core processors 
SDK 4.0/4.0.1/4.0.2/4.0.3 (Ice Cream Sandwich) 
Changes to the UI, Voice input, NFC 
Android 4.0+
Distribution of Devices 
Data collected during a 14-day period ending on January 3, 2012 
http://developer.android.com/resources/dashboard/platform-versions.html
The Android Developer Website 
• http://developer.android.com 
• This could be your homepage from now on…
What is Android? 
• A software stack for mobile devices that includes 
▫ An operating system 
▫ Middleware 
▫ Key Applications 
• Uses Linux to provide core system services 
▫ Security 
▫ Memory management 
▫ Process management 
▫ Power management 
▫ Hardware drivers 
• Android Apps are written in Java 
• Open Source with an Apache License 
• An Open Handset Alliance Project
Open Handset Alliance- a consortium of several companies
Open Handset Alliance - Many more joined 
A business alliance consisting of 
47 companies to develop 
open standards for mobile 
devices
Android Features 
Reuse and replacement of components 
Dalvik virtual machine 
Integrated browser 
Optimized graphics 
SQLite 
Media support 
GSM Telephony 
Bluetooth, EDGE, 3G, and WiFi 
Camera, GPS, compass, and accelerometer 
Rich development environment
Android makes mobile Java easier!! 
Well, sort of… 
http://code.google.com/android/goodies/index.html
Android System Architecture
Linux Kernel 
• Relying on Linux Kernel 2.6 for core system services 
▫ Memory and Process Management 
▫ Network Stack 
▫ Driver Model 
▫ Security 
▫ And other operating system services 
• Providing an abstraction layer between the H/W and 
the rest of the S/W stack
Libraries 
• C/C++ libraries 
• Interface through Java 
• Surface manager – Handling UI Windows 
• 2D and 3D graphics 
• Media codecs, SQLite, Browser engine, etc 
• Only to be called by higher level programs
Android Runtime 
• Dalvik VM (Executes .dex) 
• Providing environment on which 
every Android application runs 
• Each Android application runs in 
its own process, with its own 
instance of the Dalvik VM. 
• Device can run multiple VMs 
efficiently. 
• Register-based virtual machine Dex 
files 
• Compact and efficient than 
class files 
• Limited memory and battery 
power 
• .dex format is optimized for 
minimal memory footprint. 
• Not J2SE/J2ME 
• 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
Application Framework 
• API interface 
• View System - Used to build an application, including lists, grids, text 
boxes, buttons, and embedded web browser 
• Content Provider - Enabling applications to access data from other 
applications or to share their own data 
• Resource Manager - Providing access to non-code resources (localized strings, 
graphics, and layout files) 
• Notification Manager - Enabling all applications to display customer alerts in the 
status bar 
• Activity Manager - Managing the lifecycle of applications and providing a common 
navigation backstack 
• 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.
Applications 
• Applications and Widgets: the real programs display 
information and interact with users. 
• Built in and user apps 
• Can replace built in apps
Application Building Blocks 
• Activity 
• IntentReceiver 
• Service 
• ContentProvider
Activities 
• Typically correspond to one UI screen 
• But, they can: 
▫ Be faceless 
▫ Be in a floating window 
▫ Return a value 
• Each user interface screen is represented by an 
Activity class. 
• Each activity has its own life cycle. 
• Activity uses Intent object to jump between them.
Life cycle of an Activity Application run in their own 
processes (VM, PID) 
Processes are started and 
stopped as needed to run an 
application's components 
Processes may be killed to 
reclaim resources
Intent Receivers 
• Components that respond to broadcast ‘Intents’ 
• Way to respond to external notification or alarms 
• Apps can invent and broadcast their own Intent
Intents 
• Think of Intents as a verb and object; a description of 
what you want done 
▫ E.g. VIEW, CALL, PLAY etc.. 
• Intent provides late running binding to other apps 
• Intent activates activities, services, and broadcast 
receivers. 
• Intent can be used in explicit way or implicit way. 
• System matches Intent with Activity that can best 
provide the service 
• Activities and IntentReceivers describe what Intents they 
can service 
• When launch a intent object, framework will match and 
find the qualified components and leave them for users 
to choose which to run.
Intents 
Home 
Contacts 
GMail 
Chat 
Blogger 
“Pick photo” 
Picasa 
Photo 
Gallery 
Client component makes a 
request for a specific action 
System picks best 
Ncoemw pconmepnot nfoern ttsh acat na cutisoen 
existing functionality Blogger
Services 
• Faceless components that run in the background 
▫ E.g. music player, network download etc…
ContentProviders 
• Enables sharing of data across applications 
▫ E.g. address book, photo gallery 
• Client+server architecture 
• Provides uniform APIs for: 
▫ querying 
▫ delete, update and insert. 
• Content is represented by URI and MIME type 
• Content Resolver provides API interface for 
applications. 
• Content Providers is the server managing the DB 
tables and database content with different 
application.
Security and permissions 
• Security in Android follows standard Linux 
guidelines 
• Each application runs in its own process 
• Application can't disrupt other applications, except 
by explicitly declaring the permissions it 
• Finer grained permissions are then granted (revoked) 
per operations 
• Each Android package is given its own unique Linux 
user ID
Developing apps 
• What are they? 
▫ Any application that runs on a mobile device 
• Types 
▫ Web apps: run in a web browser 
▫ HTML, JavaScript, Flash, server-side components, etc. 
• Native - Compiled binaries for the device 
• Often make use of web services 
• Because of the apps, Smartphone(s) become smart!
Development process for an Android app
Android Apps 
• Built using Java and new SDK libraries 
▫ No support for some Java libraries like Swing & AWT 
▫ Oracle currently suing Google over use 
• Java code compiled into Dalvik byte code (.dex) 
▫ Optimized for mobile devices (better memory management, battery 
utilization, etc.) 
• Dalvik VM runs .dex files
Applications Are Boxed 
• By default, each app is run in its own 
Linux process 
▫ Process started when app’s code needs to 
be executed 
▫ Threads can be started to handle time-consuming 
operations 
• Each process has its own Dalvik VM 
• By default, each app is assigned unique 
Linux ID 
▫ Permissions are set so app’s files are only 
visible to that app
Android Design Philosophy 
• Applications should be: 
▫ Fast 
Resource constraints: <200MB RAM, slow processor 
▫ Responsive 
Apps must respond to user actions within 5 seconds 
▫ Secure 
Apps declare permissions in manifest 
▫ Seamless 
Usability is key, persist data, suspend services 
Android kills processes in background as needed
Leveraging the web 
• To keep your apps fast and responsive, consider how 
you can leverage the web 
▫ What ____________ can be ________ on a server 
or in the cloud? 
Tasks/performed 
Data/persisted 
Data/retrieved 
▫ Beware, data transfer is also expensive and can be slow
Challenges 
• CPU typically runs 500-600 Mhz 
• RAM available to an App may only 
be a few megabytes 
• Disk (flash) access is very slow 
• Lifecycle - apps must pause/quit 
often, and restore to give the 
illusion that they are always 
running 
• UI design 
• typical screen may be HVGA 
(320x480) 
• may be in portrait or landscape 
• very high DPI - small text may not 
be readable 
• touch resolution is very low (~25 
pixel) 
• Network access may be slow and 
(very) intermittent 
• Fragmentation of Hardware 
▫ Different screen resolutions 
▫ Different screen sizes 
▫ Different hardware keys 
▫ Different input methods 
• Some have a phone, some not... 
▫ Some have GPS, some not... 
▫ Some have 3G, some not... 
▫ Some have a cam, some not... 
▫ Some are good, some not... 
▫ Some are not even phones… 
• Hardware diversification will 
continue to be harder and harder.
Opportunities 
• 100s of millions of mobile phone users 
• Very high growth, esp. in Asia 
• "Wild wild west" of application development 
• think 1985 on the desktop (if you were born by then) 
• no dominant 3rd party developers.... yet 
• what will the killer app categories be? 
• what does it mean to have any app + the internet in 
your pocket? 
• You can develop for it today!
Learning 
• Reinforce the basics: OOP, decomposition, etc. 
• Separation of UI design and functionality 
• XML and resource files 
• Events and Listeners 
• Callback methods 
• Threads 
• Application of already learnt 
▫ Java! 
Inheritance, method overriding 
Interfaces, Casting 
Exceptions 
Debugging 
Reading API documentation 
▫ Eclipse 
Easy to pick up quickly, though
“Hello, Android”
Creating Your First(?) Android App 
• Set up your development environment 
• Create a new Android project in Eclipse 
• Run it in the emulator 
• Debug ensues 
• http://developer.android.com/guide/tutorials/hello-world. 
html
1. Set Up Your Android Environment 
• http://developer.android.com/sdk 
• Install Eclipse 
• Install Android SDK (Android libraries) 
• Install ADT plugin (Android development tools) 
• Create AVD (Android virtual device)
2. Create an Android Project in Eclipse 
 File → New → Project 
 Select “Android Project” 
 Fill in Project details...
Name that appears 
on device 
Directory 
name 
Class to 
automatically 
create 
Java package 
Android 
version
3. Run the Android Application 
 Run → Run (or click the “Run” button) 
 Select “Android Application” 
 The emulator may take a few minutes to start, so be 
patient! 
 You don't need to restart the emulator when you 
have a new version of your application
Hello World…
Source 
code 
Auto-generated 
code 
UI 
layout 
String 
constants 
Configuration
HelloAndroid.java 
1 public class HelloAndroid extends Activity { 
2 /** Called when the activity is first created. */ 
3 @Override 
4 public void onCreate(Bundle savedInstanceState) 
5 { 
6 super.onCreate(savedInstanceState); 
7 setContentView(R.layout.main); 
8 } 
9 }
main.xml 
1 <?xml version="1.0" encoding="utf-8"?> 
2 <LinearLayout 
3 xmlns:android="http://schemas.android.com/apk/res/android" 
4 android:orientation="vertical" 
5 android:layout_width="fill_parent" 
6 android:layout_height="fill_parent" 
7 > 
8 <TextView 
9 android:layout_width="fill_parent" 
10 android:layout_height="wrap_content" 
11 android:text="@string/hello " 
12 /> 
13 </LinearLayout>
strings.xml 
1 <?xml version="1.0" encoding="utf-8"?> 
2 <resources> 
3 <string name="hello">Hello World, HelloAndroid! 
4 </string> 
5 <string name="app_name">Hello, Android</string> 
6 </resources>
AndroidManifest.xml 
1 <?xml version="1.0" encoding="utf-8"?> 
2 <manifest 
3 xmlns:android="http://schemas.android.com/apk/res/android" 
4 package="edu.upenn.cis542" 
5 android:versionCode="1" 
6 android:versionName="1.0"> 
7 <application android:icon="@drawable/icon" 
8 android:label="@string/app_name"> 
9 <activity android:name=".HelloAndroid" 
10 android:label="@string/app_name"> 
11 <intent-filter> 
12 <action 
13 android:name="android.intent.action.MAIN" /> 
14 <category 
15 
android:name="android.intent.category.LAUNCHER"/> 
16 </intent-filter> 
17 </activity> 
18 </application> 
19 </manifest>
New Mobile Industry! 
• Mobile Payment 
• Mobile Advertisement 
• Location Based Service 
• And the usual Mobile…Voice, Text and Data
Easy to use 
Design 
All-in-one-solutions 
Appstore 
Additional 
software 
No bugs High-class products 
Good performance
Summary 
• New world of Possibilities… 
• Android seems to be the future of 
mobile OS's and mobile software 
development. 
• Android just add fun in making 
phones cooler and development easier. 
• Android could easily move its way into 
the market from phones to 
notebooks and desktops 
• After 2013, Android will dominate the 
app market
Backup Slides
Mobile Devices: Advantages 
(as compared to fixed devices) 
• Always with the user 
• Typically have Internet access 
• Typically GPS enabled 
• Typically have accelerometer & compass 
• Most have cameras & microphones 
• Many apps are free or low-cost
Mobile Devices: Disadvantages 
• Limited screen size 
• Limited battery life 
• Limited processor speed 
• Limited and sometimes slow network access 
• Limited or awkward input: soft keyboard, phone 
keypad, touch screen, or stylus 
• Limited web browser functionality 
• Range of platforms & configurations across devices
Mobile Applications 
• What are they? 
▫ Any application that runs on a mobile device 
• Types 
▫ Web apps: run in a web browser 
HTML, JavaScript, Flash, server-side components, etc. 
▫ Native: compiled binaries for the device 
Often make use of web services
Platform Highlights 
• The Android platform introduces many features for 
users and developers – Making Android even better 
• Performance Improvements 
• Faster Camera start-up and image capture 
• Much faster acquisition of GPS location (powered by 
SUPL AGPS) 
• Smoother page scrolling in Browser 
• Speedier GMail conversation list scrolling
Platform Highlights 
• On-screen soft keyboard 
▫ Works in both portrait and landscape orientation 
▫ Support for user installation of 3rd party keyboards 
▫ User dictionary for custom words 
• Home screen 
▫ Widgets 
Bundled home screen widgets include: analog clock, calendar, music 
player, picture frame, and search 
▫ Live folders 
• Camera & Gallery 
• Video recording 
• Video playback (MPEG-4 & 3GP formats) 
• Bluetooth 
▫ Stereo Bluetooth support (A2DP and AVCRP profiles) 
▫ Auto-pairing 
▫ Improved hands free experience
Platform Highlights 
• Browser 
▫ Updated with latest Webkit browser 
JavaScript engines 
▫ Copy 'n paste in browser 
▫ Search within a page 
▫ User-selectable text-encoding 
• UI changes include: 
▫ Unified Go and Search box 
▫ Tabbed bookmarks/history/most-visited 
screen 
• Contacts 
▫ Shows user picture for Favorites 
▫ Specific date/time stamp for events in call 
log 
▫ One-touch access to a contact card 
from call log event 
• System 
▫ New Linux kernel 
▫ SD card file system auto-checking and 
repair 
• SIM Application Toolkit 1.0 
• Google applications (Android SDK) 
▫ View Google Talk friends' status in Contacts, 
SMS, MMS, GMail, and Email applications 
▫ Batch actions such as archive, delete, and 
label on Gmail messages 
▫ Upload videos to YouTube 
▫ Upload photos on Picasa
Building and Running Android Apps

More Related Content

PPT
Google android os
PPT
My androidpresentation
PDF
Development Workshop on ET1, Android and Motorola RhoElements
PPT
Android General information
PPT
Introduction to android sessions new
PPT
Introduction to android
PPTX
Android Security Humla Part 1
PDF
Introduction of android
Google android os
My androidpresentation
Development Workshop on ET1, Android and Motorola RhoElements
Android General information
Introduction to android sessions new
Introduction to android
Android Security Humla Part 1
Introduction of android

What's hot (20)

PDF
. Design Decisions: Developing for Mobile - The Template Experience Project
PPTX
Android
PDF
Android Application Development
PPT
Android
PPTX
Bluestacks ANDROID
PDF
Android for Java Developers
PPTX
Introduction to android basics
PPTX
Android Application Fundamentals
PPTX
Basic of Android App Development
PDF
Gl android platform
PDF
Become a Bluemix Architect in 45 Minutes
PPT
Android For Java Developers
PPT
Android Introduction
PPTX
Variations on Video: The Avalon Media System
PDF
Understanding Docker and IBM Bluemix Container Service
PPT
Inside the Android application framework - Google I/O 2009
PDF
Lick my Lollipop
PDF
Introduction to android
PPTX
Windows 8 Introduction
PDF
Your last mile to SOA and Web 2.0- Lotus Expeditor for Devices - Eric MF Hsu,...
. Design Decisions: Developing for Mobile - The Template Experience Project
Android
Android Application Development
Android
Bluestacks ANDROID
Android for Java Developers
Introduction to android basics
Android Application Fundamentals
Basic of Android App Development
Gl android platform
Become a Bluemix Architect in 45 Minutes
Android For Java Developers
Android Introduction
Variations on Video: The Avalon Media System
Understanding Docker and IBM Bluemix Container Service
Inside the Android application framework - Google I/O 2009
Lick my Lollipop
Introduction to android
Windows 8 Introduction
Your last mile to SOA and Web 2.0- Lotus Expeditor for Devices - Eric MF Hsu,...
Ad

Similar to Android quick talk (20)

PPT
AndroidOverview
PPTX
Android Technology
PDF
First Steps with Android - An Exciting Introduction
PPT
"double quotes"
PPT
Android overview
PPT
Android overview
PPT
Android overview
PPT
Android overview
PPT
From Deepa's client
PPT
Android overview 123
PPT
Mobile appliaction w android week 1 by osama
PPT
Android overview
PPTX
Android and android phones
PDF
Mobile app
PPT
Android Anatomy
PPTX
18ITT61 - Introduction.pptx
PDF
Introduction to android
PDF
Introduction to Android
PPTX
Android development
PPTX
Introduction to Android
AndroidOverview
Android Technology
First Steps with Android - An Exciting Introduction
"double quotes"
Android overview
Android overview
Android overview
Android overview
From Deepa's client
Android overview 123
Mobile appliaction w android week 1 by osama
Android overview
Android and android phones
Mobile app
Android Anatomy
18ITT61 - Introduction.pptx
Introduction to android
Introduction to Android
Android development
Introduction to Android
Ad

More from SenthilKumar Selvaraj (12)

PPTX
Debugging Modern C++ Application with Gdb
PDF
Amma kalviyagam-free-formula-hand-book
PDF
F5500 k 30hk_50hk_xs_20130304
PDF
Sjx40 fb 9xaf
PDF
NLP Workbook
PPTX
Think again how to reason and argue (recovered)
PPTX
Empowering engineers empowering_india
PPTX
PPTX
Project points-to-ponder
PPT
Introduction to IPv6
PPT
PPTX
Effective Project Execution
Debugging Modern C++ Application with Gdb
Amma kalviyagam-free-formula-hand-book
F5500 k 30hk_50hk_xs_20130304
Sjx40 fb 9xaf
NLP Workbook
Think again how to reason and argue (recovered)
Empowering engineers empowering_india
Project points-to-ponder
Introduction to IPv6
Effective Project Execution

Recently uploaded (20)

PPTX
ManageIQ - Sprint 268 Review - Slide Deck
PPTX
VVF-Customer-Presentation2025-Ver1.9.pptx
PDF
Design an Analysis of Algorithms I-SECS-1021-03
PDF
Wondershare Filmora 15 Crack With Activation Key [2025
PPTX
ai tools demonstartion for schools and inter college
PPTX
ISO 45001 Occupational Health and Safety Management System
PPTX
Operating system designcfffgfgggggggvggggggggg
PDF
How to Migrate SBCGlobal Email to Yahoo Easily
PDF
AI in Product Development-omnex systems
PDF
Why TechBuilder is the Future of Pickup and Delivery App Development (1).pdf
PPTX
L1 - Introduction to python Backend.pptx
PPTX
Agentic AI Use Case- Contract Lifecycle Management (CLM).pptx
PDF
Adobe Illustrator 28.6 Crack My Vision of Vector Design
PDF
How to Choose the Right IT Partner for Your Business in Malaysia
PPTX
Transform Your Business with a Software ERP System
PDF
Claude Code: Everyone is a 10x Developer - A Comprehensive AI-Powered CLI Tool
PDF
PTS Company Brochure 2025 (1).pdf.......
PDF
Internet Downloader Manager (IDM) Crack 6.42 Build 41
PDF
Navsoft: AI-Powered Business Solutions & Custom Software Development
PDF
Internet Downloader Manager (IDM) Crack 6.42 Build 42 Updates Latest 2025
ManageIQ - Sprint 268 Review - Slide Deck
VVF-Customer-Presentation2025-Ver1.9.pptx
Design an Analysis of Algorithms I-SECS-1021-03
Wondershare Filmora 15 Crack With Activation Key [2025
ai tools demonstartion for schools and inter college
ISO 45001 Occupational Health and Safety Management System
Operating system designcfffgfgggggggvggggggggg
How to Migrate SBCGlobal Email to Yahoo Easily
AI in Product Development-omnex systems
Why TechBuilder is the Future of Pickup and Delivery App Development (1).pdf
L1 - Introduction to python Backend.pptx
Agentic AI Use Case- Contract Lifecycle Management (CLM).pptx
Adobe Illustrator 28.6 Crack My Vision of Vector Design
How to Choose the Right IT Partner for Your Business in Malaysia
Transform Your Business with a Software ERP System
Claude Code: Everyone is a 10x Developer - A Comprehensive AI-Powered CLI Tool
PTS Company Brochure 2025 (1).pdf.......
Internet Downloader Manager (IDM) Crack 6.42 Build 41
Navsoft: AI-Powered Business Solutions & Custom Software Development
Internet Downloader Manager (IDM) Crack 6.42 Build 42 Updates Latest 2025

Android quick talk

  • 2. Apps on the Device In the past: Today: Entertainment purpose Substantial purchase criteria
  • 3. Agenda • Mobile Application Development (MAD) • Intro to Android platform • Platform architecture • Application building blocks • Development tools • Hello Android
  • 4. Why MAD? (Mobile App Development) • The fact that we can! • Mobile platform is the platform of the future ▫ Double-digit growth in world-wide smartphone ownership3 • Smart Phones • Internet access anywhere • Social networking • Millions of mobile users • Open standards • Job market is hot ▫ Market for mobile software surges from $4.1 billion in 2009 to $17.5 billion by 20121 ▫ 2010 Dice.com survey: 72% of recruiters looking for iPhone app developers, 60% for Android • Students (and faculty!) are naturally interested!
  • 5. Why Android? • A lot of students have them ▫ 2010 survey: 22% of college students have Android phone (26% Blackberry, 40% iPhone) ▫ Gartner survey: Android used on 22.7% of smartphones sold world-wide in 2010 (37.6% Symbian, 15.7% iOS) • Students already know Java and Eclipse ▫ Low learning curve ▫ Students can use App Inventor for Android • Transferring app to phone is trivial ▫ Can distribute by putting it on the web ▫ Android Market for wider distribution • It’s not 1984
  • 10. Brief History • 1996 ▫ The WWW already had websites with color and images, but, the best phones displayed a couple of lines of monochrome text! ▫ Enter: Wireless Application Protocol and Markup Language WAP : Stripped down bandwidth reduction WML : Stripped down HTML for content Many issues (WAP = “Wait And Pay”) Few developers to produce content (it wasn’t fun!) ▫ Really hard to type in URLs using the small keyboards ▫ Data fees frightfully expensive ▫ No billing mechanism – content difficult to monetize • Other platforms emerged ▫ Palm OS, Blackberry OS, J2ME, Symbian (Nokia), BREW, OS X iPhone, Windows Mobile
  • 11. Brief History - Android • 2005 ▫ Google acquires startup Android Inc. to start Android platform ▫ Work on Dalvik VM begins • 2007 ▫ Open Handset Alliance formed to develop open standards for mobile devices ▫ Early look at SDK • 2008 ▫ Google sponsors 1st Android Developer Challenge ▫ T-Mobile G1 announced ▫ SDK 1.0 released ▫ Android released open source (Apache License) ▫ Android Dev Phone 1 released ▫ Android Source code Published • 2009 ▫ SDK 1.5 (Cupcake) New soft keyboard with “autocomplete” feature ▫ SDK 1.6 (Donut) Support Wide VGA ▫ SDK 2.0/2.0.1/2.1 (Eclair) Revamped UI, Browser • 2010 ▫ Nexus One released to the public ▫ SDK 2.2 (Froyo) Flash support, Tethering ▫ SDK 2.3 (Gingerbread) UI update, system-wide copy-paste
  • 12. Brief History - Android Honeycomb Android 3.0-3.2 • 2011 ▫ SDK 3.0/3.1/3.2 (Honeycomb) for tablets only Ice cream Sandwich New UI for tablets, support multi-core processors SDK 4.0/4.0.1/4.0.2/4.0.3 (Ice Cream Sandwich) Changes to the UI, Voice input, NFC Android 4.0+
  • 13. Distribution of Devices Data collected during a 14-day period ending on January 3, 2012 http://developer.android.com/resources/dashboard/platform-versions.html
  • 14. The Android Developer Website • http://developer.android.com • This could be your homepage from now on…
  • 15. What is Android? • A software stack for mobile devices that includes ▫ An operating system ▫ Middleware ▫ Key Applications • Uses Linux to provide core system services ▫ Security ▫ Memory management ▫ Process management ▫ Power management ▫ Hardware drivers • Android Apps are written in Java • Open Source with an Apache License • An Open Handset Alliance Project
  • 16. Open Handset Alliance- a consortium of several companies
  • 17. Open Handset Alliance - Many more joined A business alliance consisting of 47 companies to develop open standards for mobile devices
  • 18. Android Features Reuse and replacement of components Dalvik virtual machine Integrated browser Optimized graphics SQLite Media support GSM Telephony Bluetooth, EDGE, 3G, and WiFi Camera, GPS, compass, and accelerometer Rich development environment
  • 19. Android makes mobile Java easier!! Well, sort of… http://code.google.com/android/goodies/index.html
  • 21. Linux Kernel • Relying on Linux Kernel 2.6 for core system services ▫ Memory and Process Management ▫ Network Stack ▫ Driver Model ▫ Security ▫ And other operating system services • Providing an abstraction layer between the H/W and the rest of the S/W stack
  • 22. Libraries • C/C++ libraries • Interface through Java • Surface manager – Handling UI Windows • 2D and 3D graphics • Media codecs, SQLite, Browser engine, etc • Only to be called by higher level programs
  • 23. Android Runtime • Dalvik VM (Executes .dex) • Providing environment on which every Android application runs • Each Android application runs in its own process, with its own instance of the Dalvik VM. • Device can run multiple VMs efficiently. • Register-based virtual machine Dex files • Compact and efficient than class files • Limited memory and battery power • .dex format is optimized for minimal memory footprint. • Not J2SE/J2ME • 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
  • 24. Application Framework • API interface • View System - Used to build an application, including lists, grids, text boxes, buttons, and embedded web browser • Content Provider - Enabling applications to access data from other applications or to share their own data • Resource Manager - Providing access to non-code resources (localized strings, graphics, and layout files) • Notification Manager - Enabling all applications to display customer alerts in the status bar • Activity Manager - Managing the lifecycle of applications and providing a common navigation backstack • 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.
  • 25. Applications • Applications and Widgets: the real programs display information and interact with users. • Built in and user apps • Can replace built in apps
  • 26. Application Building Blocks • Activity • IntentReceiver • Service • ContentProvider
  • 27. Activities • Typically correspond to one UI screen • But, they can: ▫ Be faceless ▫ Be in a floating window ▫ Return a value • Each user interface screen is represented by an Activity class. • Each activity has its own life cycle. • Activity uses Intent object to jump between them.
  • 28. Life cycle of an Activity Application run in their own processes (VM, PID) Processes are started and stopped as needed to run an application's components Processes may be killed to reclaim resources
  • 29. Intent Receivers • Components that respond to broadcast ‘Intents’ • Way to respond to external notification or alarms • Apps can invent and broadcast their own Intent
  • 30. Intents • Think of Intents as a verb and object; a description of what you want done ▫ E.g. VIEW, CALL, PLAY etc.. • Intent provides late running binding to other apps • Intent activates activities, services, and broadcast receivers. • Intent can be used in explicit way or implicit way. • System matches Intent with Activity that can best provide the service • Activities and IntentReceivers describe what Intents they can service • When launch a intent object, framework will match and find the qualified components and leave them for users to choose which to run.
  • 31. Intents Home Contacts GMail Chat Blogger “Pick photo” Picasa Photo Gallery Client component makes a request for a specific action System picks best Ncoemw pconmepnot nfoern ttsh acat na cutisoen existing functionality Blogger
  • 32. Services • Faceless components that run in the background ▫ E.g. music player, network download etc…
  • 33. ContentProviders • Enables sharing of data across applications ▫ E.g. address book, photo gallery • Client+server architecture • Provides uniform APIs for: ▫ querying ▫ delete, update and insert. • Content is represented by URI and MIME type • Content Resolver provides API interface for applications. • Content Providers is the server managing the DB tables and database content with different application.
  • 34. Security and permissions • Security in Android follows standard Linux guidelines • Each application runs in its own process • Application can't disrupt other applications, except by explicitly declaring the permissions it • Finer grained permissions are then granted (revoked) per operations • Each Android package is given its own unique Linux user ID
  • 35. Developing apps • What are they? ▫ Any application that runs on a mobile device • Types ▫ Web apps: run in a web browser ▫ HTML, JavaScript, Flash, server-side components, etc. • Native - Compiled binaries for the device • Often make use of web services • Because of the apps, Smartphone(s) become smart!
  • 36. Development process for an Android app
  • 37. Android Apps • Built using Java and new SDK libraries ▫ No support for some Java libraries like Swing & AWT ▫ Oracle currently suing Google over use • Java code compiled into Dalvik byte code (.dex) ▫ Optimized for mobile devices (better memory management, battery utilization, etc.) • Dalvik VM runs .dex files
  • 38. Applications Are Boxed • By default, each app is run in its own Linux process ▫ Process started when app’s code needs to be executed ▫ Threads can be started to handle time-consuming operations • Each process has its own Dalvik VM • By default, each app is assigned unique Linux ID ▫ Permissions are set so app’s files are only visible to that app
  • 39. Android Design Philosophy • Applications should be: ▫ Fast Resource constraints: <200MB RAM, slow processor ▫ Responsive Apps must respond to user actions within 5 seconds ▫ Secure Apps declare permissions in manifest ▫ Seamless Usability is key, persist data, suspend services Android kills processes in background as needed
  • 40. Leveraging the web • To keep your apps fast and responsive, consider how you can leverage the web ▫ What ____________ can be ________ on a server or in the cloud? Tasks/performed Data/persisted Data/retrieved ▫ Beware, data transfer is also expensive and can be slow
  • 41. Challenges • CPU typically runs 500-600 Mhz • RAM available to an App may only be a few megabytes • Disk (flash) access is very slow • Lifecycle - apps must pause/quit often, and restore to give the illusion that they are always running • UI design • typical screen may be HVGA (320x480) • may be in portrait or landscape • very high DPI - small text may not be readable • touch resolution is very low (~25 pixel) • Network access may be slow and (very) intermittent • Fragmentation of Hardware ▫ Different screen resolutions ▫ Different screen sizes ▫ Different hardware keys ▫ Different input methods • Some have a phone, some not... ▫ Some have GPS, some not... ▫ Some have 3G, some not... ▫ Some have a cam, some not... ▫ Some are good, some not... ▫ Some are not even phones… • Hardware diversification will continue to be harder and harder.
  • 42. Opportunities • 100s of millions of mobile phone users • Very high growth, esp. in Asia • "Wild wild west" of application development • think 1985 on the desktop (if you were born by then) • no dominant 3rd party developers.... yet • what will the killer app categories be? • what does it mean to have any app + the internet in your pocket? • You can develop for it today!
  • 43. Learning • Reinforce the basics: OOP, decomposition, etc. • Separation of UI design and functionality • XML and resource files • Events and Listeners • Callback methods • Threads • Application of already learnt ▫ Java! Inheritance, method overriding Interfaces, Casting Exceptions Debugging Reading API documentation ▫ Eclipse Easy to pick up quickly, though
  • 45. Creating Your First(?) Android App • Set up your development environment • Create a new Android project in Eclipse • Run it in the emulator • Debug ensues • http://developer.android.com/guide/tutorials/hello-world. html
  • 46. 1. Set Up Your Android Environment • http://developer.android.com/sdk • Install Eclipse • Install Android SDK (Android libraries) • Install ADT plugin (Android development tools) • Create AVD (Android virtual device)
  • 47. 2. Create an Android Project in Eclipse  File → New → Project  Select “Android Project”  Fill in Project details...
  • 48. Name that appears on device Directory name Class to automatically create Java package Android version
  • 49. 3. Run the Android Application  Run → Run (or click the “Run” button)  Select “Android Application”  The emulator may take a few minutes to start, so be patient!  You don't need to restart the emulator when you have a new version of your application
  • 51. Source code Auto-generated code UI layout String constants Configuration
  • 52. HelloAndroid.java 1 public class HelloAndroid extends Activity { 2 /** Called when the activity is first created. */ 3 @Override 4 public void onCreate(Bundle savedInstanceState) 5 { 6 super.onCreate(savedInstanceState); 7 setContentView(R.layout.main); 8 } 9 }
  • 53. main.xml 1 <?xml version="1.0" encoding="utf-8"?> 2 <LinearLayout 3 xmlns:android="http://schemas.android.com/apk/res/android" 4 android:orientation="vertical" 5 android:layout_width="fill_parent" 6 android:layout_height="fill_parent" 7 > 8 <TextView 9 android:layout_width="fill_parent" 10 android:layout_height="wrap_content" 11 android:text="@string/hello " 12 /> 13 </LinearLayout>
  • 54. strings.xml 1 <?xml version="1.0" encoding="utf-8"?> 2 <resources> 3 <string name="hello">Hello World, HelloAndroid! 4 </string> 5 <string name="app_name">Hello, Android</string> 6 </resources>
  • 55. AndroidManifest.xml 1 <?xml version="1.0" encoding="utf-8"?> 2 <manifest 3 xmlns:android="http://schemas.android.com/apk/res/android" 4 package="edu.upenn.cis542" 5 android:versionCode="1" 6 android:versionName="1.0"> 7 <application android:icon="@drawable/icon" 8 android:label="@string/app_name"> 9 <activity android:name=".HelloAndroid" 10 android:label="@string/app_name"> 11 <intent-filter> 12 <action 13 android:name="android.intent.action.MAIN" /> 14 <category 15 android:name="android.intent.category.LAUNCHER"/> 16 </intent-filter> 17 </activity> 18 </application> 19 </manifest>
  • 56. New Mobile Industry! • Mobile Payment • Mobile Advertisement • Location Based Service • And the usual Mobile…Voice, Text and Data
  • 57. Easy to use Design All-in-one-solutions Appstore Additional software No bugs High-class products Good performance
  • 58. Summary • New world of Possibilities… • Android seems to be the future of mobile OS's and mobile software development. • Android just add fun in making phones cooler and development easier. • Android could easily move its way into the market from phones to notebooks and desktops • After 2013, Android will dominate the app market
  • 60. Mobile Devices: Advantages (as compared to fixed devices) • Always with the user • Typically have Internet access • Typically GPS enabled • Typically have accelerometer & compass • Most have cameras & microphones • Many apps are free or low-cost
  • 61. Mobile Devices: Disadvantages • Limited screen size • Limited battery life • Limited processor speed • Limited and sometimes slow network access • Limited or awkward input: soft keyboard, phone keypad, touch screen, or stylus • Limited web browser functionality • Range of platforms & configurations across devices
  • 62. Mobile Applications • What are they? ▫ Any application that runs on a mobile device • Types ▫ Web apps: run in a web browser HTML, JavaScript, Flash, server-side components, etc. ▫ Native: compiled binaries for the device Often make use of web services
  • 63. Platform Highlights • The Android platform introduces many features for users and developers – Making Android even better • Performance Improvements • Faster Camera start-up and image capture • Much faster acquisition of GPS location (powered by SUPL AGPS) • Smoother page scrolling in Browser • Speedier GMail conversation list scrolling
  • 64. Platform Highlights • On-screen soft keyboard ▫ Works in both portrait and landscape orientation ▫ Support for user installation of 3rd party keyboards ▫ User dictionary for custom words • Home screen ▫ Widgets Bundled home screen widgets include: analog clock, calendar, music player, picture frame, and search ▫ Live folders • Camera & Gallery • Video recording • Video playback (MPEG-4 & 3GP formats) • Bluetooth ▫ Stereo Bluetooth support (A2DP and AVCRP profiles) ▫ Auto-pairing ▫ Improved hands free experience
  • 65. Platform Highlights • Browser ▫ Updated with latest Webkit browser JavaScript engines ▫ Copy 'n paste in browser ▫ Search within a page ▫ User-selectable text-encoding • UI changes include: ▫ Unified Go and Search box ▫ Tabbed bookmarks/history/most-visited screen • Contacts ▫ Shows user picture for Favorites ▫ Specific date/time stamp for events in call log ▫ One-touch access to a contact card from call log event • System ▫ New Linux kernel ▫ SD card file system auto-checking and repair • SIM Application Toolkit 1.0 • Google applications (Android SDK) ▫ View Google Talk friends' status in Contacts, SMS, MMS, GMail, and Email applications ▫ Batch actions such as archive, delete, and label on Gmail messages ▫ Upload videos to YouTube ▫ Upload photos on Picasa
  • 66. Building and Running Android Apps