45
Introduction to Android™ Application Development, Android Essentials, Fourth Edition Chapter 1 Introducing Android From Introduction to Android™ Application Development, Android Essentials, Fourth Edition, by Joseph Annuzzi, Jr., Lauren Darcey, and Shane Conder (ISBN-13: 978-0-321-94026-1) Copyright © 2014 Pearson Education, Inc. All rights reserved.

Chapter 1 Introducing Android · Native programming in Java Traditional programming constructs – Threads and processes – Data structures for encapsulation Familiar class libraries

  • Upload
    others

  • View
    34

  • Download
    0

Embed Size (px)

Citation preview

Introduction to Android™ Application Development, Android Essentials,

Fourth Edition

Chapter 1

Introducing Android

From Introduction to Android™ Application Development, Android Essentials, Fourth Edition, by Joseph Annuzzi, Jr., Lauren Darcey, and Shane Conder (ISBN-13: 978-0-321-94026-1) Copyright © 2014 Pearson Education, Inc. All rights reserved.

4.2

List of countries by number of mobile phones in use- World 6,800,000,000+ 7,012,000,000[1] 97

01 China 1,227,360,000 1,349,585,838 89.2

02 India 904,480,000 1,220,800,359 74.96

03 United States 327,577,529 350,000,000 103.9

04 Brazil 271,100,000 201,032,714 136.45

05 Russia 256,116,000 142,905,200 155.5

06 Indonesia 236,800,000 237,556,363 99.68

07 Pakistan 130,583,076 188,854,781 69.18

08 Japan 121,246,700 127,628,095 95.1

09 Nigeria 114,000,000 165,200,000 69.0

10 Bangladesh 113,784,000 165,039,000 73.8

11 Germany 107,000,000 81,882,342 130.1

12 Philippines 106,987,098 94,013,200 113.8

13 Iran 96,165,000 73,973,000 130.0

14 Mexico 92,900,000 112,322,757 82.7

15 Italy 88,580,000 60,090,400 147.4

16 United Kingdom 75,750,000 61,612,300 122.9

4.3

Europe mobile phone penetration map

4.4

4.5

Global smartphone market share

From Android Wireless Application Development, Vol. 1, 4th Edition, by Joseph Annuzzi, Jr., Lauren Darcey, and Shane Conder (ISBN-13: 978-0-32-194026-1) Copyright © 2013 Pearson Education, Inc. All rights reserved.

From Android Wireless Application Development, Vol. 1, 4th Edition, by Joseph Annuzzi, Jr., Lauren Darcey, and Shane Conder (ISBN-13: 978-0-32-194026-1) Copyright © 2013 Pearson Education, Inc. All rights reserved.

4.8

4.9

Chapter 1Overview

A brief history of mobile software development

The Open Handset Alliance

How Android is different from other platforms

A first look at the Android platform

From Introduction to Android™ Application Development, Android Essentials, Fourth Edition, by Joseph Annuzzi, Jr., Lauren Darcey, and Shane Conder (ISBN-13: 978-0-321-94026-1) Copyright © 2014 Pearson Education, Inc. All rights reserved.

A Brief History of Mobile Software

Development

“The Brick”

– The Motorola DynaTAC 8000X

• Dynamic Adaptive Total Area Coverage

– First commercially available cell phone

– 1983

– 13 x 1.75 x 3.5 inches in dimension

– 2.5 pounds

– Talk time around 30 minutes

– Retail price of $3,995

– Hefty monthly service fees

– Hefty per-minute charges

From Introduction to Android™ Application Development, Android Essentials, Fourth Edition, by Joseph Annuzzi, Jr., Lauren Darcey, and Shane Conder (ISBN-13: 978-0-321-94026-1) Copyright © 2014 Pearson Education, Inc. All rights reserved.

A History of Mobile (Cont’d)

“The Brick”

From Introduction to Android™ Application Development, Android Essentials, Fourth Edition, by Joseph Annuzzi, Jr., Lauren Darcey, and Shane Conder (ISBN-13: 978-0-321-94026-1) Copyright © 2014 Pearson Education, Inc. All rights reserved.

A History of Mobile (Cont’d)

Early phones

– Used to make and receive calls

– Not full featured like today

– SEND, END, CLR buttons

– Some even had a contacts application

– Designed and developed by handset manufacturers

– Software developed in-house

– No opportunities for outside developers

From Introduction to Android™ Application Development, Android Essentials, Fourth Edition, by Joseph Annuzzi, Jr., Lauren Darcey, and Shane Conder (ISBN-13: 978-0-321-94026-1) Copyright © 2014 Pearson Education, Inc. All rights reserved.

A History of Mobile (Cont’d)

Introduction of “time-waster” games

– Nokia famous for loading 1970s Snake game

– Others followed suit

• Pong

• Tetris

• Tic-Tac-Toe

Changed how people thought of communication

Customers wanted more

Difficult for manufacturers to keep up with demand for

software

From Introduction to Android™ Application Development, Android Essentials, Fourth Edition, by Joseph Annuzzi, Jr., Lauren Darcey, and Shane Conder (ISBN-13: 978-0-321-94026-1) Copyright © 2014 Pearson Education, Inc. All rights reserved.

Wireless Application Protocol

(WAP)

Their solution?

– The Internet!

But wait! There are too many problems

– Direct phone access to the Internet didn’t scale well for mobile

– Internet used text, media, JavaScript, Flash, and other

technologies

– Target resolution for the Internet was 800 x 600 pixels or

higher

From Introduction to Android™ Application Development, Android Essentials, Fourth Edition, by Joseph Annuzzi, Jr., Lauren Darcey, and Shane Conder (ISBN-13: 978-0-321-94026-1) Copyright © 2014 Pearson Education, Inc. All rights reserved.

The Open Handset Alliance

Google goes wireless

What would it take to build a better mobile phone?

The Open Handset Alliance (OHA)

– Formed in November 2007

– Business alliance composed of mobile players

• Chip makers

• Handset manufacturers

• Software developers

• Service providers

From Introduction to Android™ Application Development, Android Essentials, Fourth Edition, by Joseph Annuzzi, Jr., Lauren Darcey, and Shane Conder (ISBN-13: 978-0-321-94026-1) Copyright © 2014 Pearson Education, Inc. All rights reserved.

The Open Handset Alliance

(Cont’d)

Android, Inc.

– Created by Andy Rubin

– Acquired by Google in 2005

OHA began developing open standards based on

Android, Inc., technologies

– The result is the Android project

Google provided initial code

Google provides online documentation, tools,

forums, SDK

From Introduction to Android™ Application Development, Android Essentials, Fourth Edition, by Joseph Annuzzi, Jr., Lauren Darcey, and Shane Conder (ISBN-13: 978-0-321-94026-1) Copyright © 2014 Pearson Education, Inc. All rights reserved.

Manufacturers: Designing

Android Devices

Samsung

Motorola

Dell

Sony Ericsson

HTC

LG

Amazon

Intel

Texas Instrument

ARM

NVIDIA

Qualcomm

From Introduction to Android™ Application Development, Android Essentials, Fourth Edition, by Joseph Annuzzi, Jr., Lauren Darcey, and Shane Conder (ISBN-13: 978-0-321-94026-1) Copyright © 2014 Pearson Education, Inc. All rights reserved.

Manufacturers: Designing

Android Devices (Cont’d)

T-Mobile G1 by HTC

– Released October 2008

– First shipping Android handset

By Q4 2010 Android dominated the smartphone

market

As of May 2013

– Android devices shipped to more than 130 countries

– 1.5 million activations daily

– 900 million total activations to date

From Introduction to Android™ Application Development, Android Essentials, Fourth Edition, by Joseph Annuzzi, Jr., Lauren Darcey, and Shane Conder (ISBN-13: 978-0-321-94026-1) Copyright © 2014 Pearson Education, Inc. All rights reserved.

Mobile Operators: Delivering

the Android Experience

Android adoption drivers

– Device subsidies

– Motorola Droid brand

– Samsung Galaxy S line

• 100 million devices sold as of January 2013

– Google Nexus branded devices

• Nexus 4 (LG)

• Nexus 7 (Asus)

• Nexus 10 (Samsung)

– HTC, LG, Asus, and more

From Introduction to Android™ Application Development, Android Essentials, Fourth Edition, by Joseph Annuzzi, Jr., Lauren Darcey, and Shane Conder (ISBN-13: 978-0-321-94026-1) Copyright © 2014 Pearson Education, Inc. All rights reserved.

Apps Drive Device Sales:

Developing Android Apps

Android’s first killer apps

– Email

– Browser

– Google Play store (formerly Android Market)

As of July 2013

– 50 billion installations

– Not including other Android marketplaces

– Not including Web applications

From Introduction to Android™ Application Development, Android Essentials, Fourth Edition, by Joseph Annuzzi, Jr., Lauren Darcey, and Shane Conder (ISBN-13: 978-0-321-94026-1) Copyright © 2014 Pearson Education, Inc. All rights reserved.

Apps Drive Device Sales:

Developing Android Apps

(Cont’d)

The Google Play store has recently received a

significant redesign

Games are a growing focus

– Recently released Google Play Game Services

SDK

Google Play’s focus on content

From Introduction to Android™ Application Development, Android Essentials, Fourth Edition, by Joseph Annuzzi, Jr., Lauren Darcey, and Shane Conder (ISBN-13: 978-0-321-94026-1) Copyright © 2014 Pearson Education, Inc. All rights reserved.

The Android Marketplace:

Where We Are Now

Competitive hardware and software feature

upgrades

Expansion beyond smartphones

– Tablets

– Watches

– Video game consoles

Almost free

Improved user-facing features

From Introduction to Android™ Application Development, Android Essentials, Fourth Edition, by Joseph Annuzzi, Jr., Lauren Darcey, and Shane Conder (ISBN-13: 978-0-321-94026-1) Copyright © 2014 Pearson Education, Inc. All rights reserved.

Android Platform Differences

“The first complete, open, and free mobile

platform”

– Complete

• Secure OS

• Robust framework

– Open

• Android is provided under open-source licensing

– Free

• Applications are free to develop

From Introduction to Android™ Application Development, Android Essentials, Fourth Edition, by Joseph Annuzzi, Jr., Lauren Darcey, and Shane Conder (ISBN-13: 978-0-321-94026-1) Copyright © 2014 Pearson Education, Inc. All rights reserved.

Android: A Next-Generation

Platform

From Introduction to Android™ Application Development, Android Essentials, Fourth Edition, by Joseph Annuzzi, Jr., Lauren Darcey, and Shane Conder (ISBN-13: 978-0-321-94026-1) Copyright © 2014 Pearson Education, Inc. All rights reserved.

Free and Open Source

Neither developers nor device manufacturers pay

royalties or license fees

Licensed under GNU General Public License

Version 2 (GPLv2)

– Strong “copyleft”

Framework distributed under Apache Software

License (ASL/Apache2)

No need for developers to provide improvements

to the open-source community

From Introduction to Android™ Application Development, Android Essentials, Fourth Edition, by Joseph Annuzzi, Jr., Lauren Darcey, and Shane Conder (ISBN-13: 978-0-321-94026-1) Copyright © 2014 Pearson Education, Inc. All rights reserved.

Familiar and Inexpensive

Development Tools

Freely available Software Development Kit

Familiar programming language

Familiar development environment

– Eclipse IDE has been the most popular

– Android Developer Tools (ADT) Eclipse plugin

– Easiest to use the Android IDE

• Eclipse IDE with ADT preconfigured and included in the

Android SDK Bundle

From Introduction to Android™ Application Development, Android Essentials, Fourth Edition, by Joseph Annuzzi, Jr., Lauren Darcey, and Shane Conder (ISBN-13: 978-0-321-94026-1) Copyright © 2014 Pearson Education, Inc. All rights reserved.

Familiar and Inexpensive

Development Tools (Cont’d)

Develop using the following operating systems:

– Windows XP (32-bit)

– Windows Vista (32-bit or 64-bit)

– Windows 7 (32-bit or 64-bit)

– Mac OS X 10.5.8 or later (x86 only)

– Linux

• 8.04 LTS or later is required

From Introduction to Android™ Application Development, Android Essentials, Fourth Edition, by Joseph Annuzzi, Jr., Lauren Darcey, and Shane Conder (ISBN-13: 978-0-321-94026-1) Copyright © 2014 Pearson Education, Inc. All rights reserved.

Reasonable Learning Curve for

Developers

Native programming in Java

Traditional programming constructs

– Threads and processes

– Data structures for encapsulation

Familiar class libraries

– java.net, java.text, etc.

Specialty libraries

– OpenGL ES

– SQLite

From Introduction to Android™ Application Development, Android Essentials, Fourth Edition, by Joseph Annuzzi, Jr., Lauren Darcey, and Shane Conder (ISBN-13: 978-0-321-94026-1) Copyright © 2014 Pearson Education, Inc. All rights reserved.

Enabling Development of

Powerful Applications

No distinction between native and third-party apps

All apps have access to the same APIs

Unprecedented access to the underlying hardware

Ability to extend or replace existing applications

From Introduction to Android™ Application Development, Android Essentials, Fourth Edition, by Joseph Annuzzi, Jr., Lauren Darcey, and Shane Conder (ISBN-13: 978-0-321-94026-1) Copyright © 2014 Pearson Education, Inc. All rights reserved.

Rich, Secure Application

Integration

One of Android’s compelling features is its well-

designed application integration

– Developers can leverage core functionality and seamlessly

create new experiences

– Applications can also become content providers and share

their information with others in secure ways

From Introduction to Android™ Application Development, Android Essentials, Fourth Edition, by Joseph Annuzzi, Jr., Lauren Darcey, and Shane Conder (ISBN-13: 978-0-321-94026-1) Copyright © 2014 Pearson Education, Inc. All rights reserved.

No Costly Obstacles for

Development

No testing and certification programs required

One-time low-cost $25 fee to distribute using the

Google Play store

No real costs other than time

Requirements

– Computer

– Good idea

– Understanding of Java

– This book will also help

From Introduction to Android™ Application Development, Android Essentials, Fourth Edition, by Joseph Annuzzi, Jr., Lauren Darcey, and Shane Conder (ISBN-13: 978-0-321-94026-1) Copyright © 2014 Pearson Education, Inc. All rights reserved.

A “Free Market” for

Applications

Free to choose the revenue model

Free to create applications for any size

demographic

Free to choose distribution methods

– Google Play store

– Amazon Appstore

– Other third-party stores

– Own distribution methods

Free to choose payment mechanisms

From Introduction to Android™ Application Development, Android Essentials, Fourth Edition, by Joseph Annuzzi, Jr., Lauren Darcey, and Shane Conder (ISBN-13: 978-0-321-94026-1) Copyright © 2014 Pearson Education, Inc. All rights reserved.

A “Free Market” for

Applications (Cont’d)

The Google Play Store online showing apps

From Introduction to Android™ Application Development, Android Essentials, Fourth Edition, by Joseph Annuzzi, Jr., Lauren Darcey, and Shane Conder (ISBN-13: 978-0-321-94026-1) Copyright © 2014 Pearson Education, Inc. All rights reserved.

Android’s Underlying

Architecture

Linux Operating System– Currently using the Linux 3.4 kernel

– Handles core system services

– Acts as a hardware abstraction layer (HAL)

– Enforcement of application permissions and security

– Low-level memory management

– Process management and threading

– Network stack

– Display, keypad input, camera, Wi-Fi, Flash memory, audio, binder

(IPC), and power management driver access

Android application runtime environment– Each app runs in its own Dalvik virtual machine (VM) in a separate

process

– Dalvik is based on the Java VM optimized for mobile

From Introduction to Android™ Application Development, Android Essentials, Fourth Edition, by Joseph Annuzzi, Jr., Lauren Darcey, and Shane Conder (ISBN-13: 978-0-321-94026-1) Copyright © 2014 Pearson Education, Inc. All rights reserved.

Android’s Underlying

Architecture (Cont’d)

From Introduction to Android™ Application Development, Android Essentials, Fourth Edition, by Joseph Annuzzi, Jr., Lauren Darcey, and Shane Conder (ISBN-13: 978-0-321-94026-1) Copyright © 2014 Pearson Education, Inc. All rights reserved.

37

Securities and Permissions

Security measures help ensure data security

Help prevent malware

Applications as operating system users

Explicitly defined application permissions

Limited ad hoc permissions

– content://contacts/phones

Application signing for trust relationships

Google Play developer registration

From Introduction to Android™ Application Development, Android Essentials, Fourth Edition, by Joseph Annuzzi, Jr., Lauren Darcey, and Shane Conder (ISBN-13: 978-0-321-94026-1) Copyright © 2014 Pearson Education, Inc. All rights reserved.

Developing Android

Applications

Extensive Android SDK and APIs provided

Programming language choices– Java

– C/C++

– WebView (HTML, CSS, JS)

– Adobe AIR

– Scripting Layer for Android (SL4A)

No distinction between native and third-party apps– Provided they have appropriate permissions, all apps have access to

the same code libraries and underlying hardware interfaces

From Introduction to Android™ Application Development, Android Essentials, Fourth Edition, by Joseph Annuzzi, Jr., Lauren Darcey, and Shane Conder (ISBN-13: 978-0-321-94026-1) Copyright © 2014 Pearson Education, Inc. All rights reserved.

Commonly Used Packages

UI controls (Buttons, Spinners, Text, Input)

UI layouts (Tables, Tabs, Lists, Galleries)

Secure networking and Web browsing (SSL, WebKit)

XML support (DOM, SAX, XML Pull Parser)

Storage and databases (App Preferences, SQLite)

2D and 3D graphics (SGL, OpenGL ES, RenderScript)

Multimedia (MediaPlayer, JetPlayer, SoundPool)

Media formats (MPEG4, H.264, MP3, AAC, AMR, JPG, PNG)

Hardware (GPS, USB, Wi-Fi, Bluetooth, sensors)

From Introduction to Android™ Application Development, Android Essentials, Fourth Edition, by Joseph Annuzzi, Jr., Lauren Darcey, and Shane Conder (ISBN-13: 978-0-321-94026-1) Copyright © 2014 Pearson Education, Inc. All rights reserved.

Android Application Framework

Framework key components

– Activities are functions the application performs

– Groups of views define the app’s layout

– Intents inform the system of an app’s plans

– Services allow background processing without user interaction

– Notifications alert users when something happens

– Content providers facilitate data transmission among different

apps

From Introduction to Android™ Application Development, Android Essentials, Fourth Edition, by Joseph Annuzzi, Jr., Lauren Darcey, and Shane Conder (ISBN-13: 978-0-321-94026-1) Copyright © 2014 Pearson Education, Inc. All rights reserved.

Android Platform Services

Apps interact with the OS and hardware using

managers– LocationManager

– ViewManager

– WindowManager

– AccessibilityManager

– ClipboardManager

– DownloadManager

– FragmentManager

– AudioManager

There are others too

From Introduction to Android™ Application Development, Android Essentials, Fourth Edition, by Joseph Annuzzi, Jr., Lauren Darcey, and Shane Conder (ISBN-13: 978-0-321-94026-1) Copyright © 2014 Pearson Education, Inc. All rights reserved.

Google Services

Google APIs for Google Services

– Maps

– Location-based services

– Game Services

– Authorization APIs

– Google Plus

– Play Services

– In-app Billing

– Google Cloud Messaging

– Google Analytics

– Google AdMob ads

From Introduction to Android™ Application Development, Android Essentials, Fourth Edition, by Joseph Annuzzi, Jr., Lauren Darcey, and Shane Conder (ISBN-13: 978-0-321-94026-1) Copyright © 2014 Pearson Education, Inc. All rights reserved.

Chapter 1Summary

We learned about the history of mobile software

development

We learned what the Open Handset Alliance is

and why it was formed

We learned how Android is different from other

platforms

We also took a first look at the Android platform

From Introduction to Android™ Application Development, Android Essentials, Fourth Edition, by Joseph Annuzzi, Jr., Lauren Darcey, and Shane Conder (ISBN-13: 978-0-321-94026-1) Copyright © 2014 Pearson Education, Inc. All rights reserved.

References and More

Information

Android Development:

– http://d.android.com/index.html

Open Handset Alliance:

– http://www.openhandsetalliance.com

Official Android Developers Blog:

– http://android-developers.blogspot.com

This book’s blog:

– http://introductiontoandroid.blogspot.com

From Introduction to Android™ Application Development, Android Essentials, Fourth Edition, by Joseph Annuzzi, Jr., Lauren Darcey, and Shane Conder (ISBN-13: 978-0-321-94026-1) Copyright © 2014 Pearson Education, Inc. All rights reserved.