51
Developing Applications for Android Muhammad Usman Chaudhry SZABIST CS4615 Lecture # 1

Developing Applications for Android - Lecture#1

  • View
    1.960

  • Download
    0

Embed Size (px)

DESCRIPTION

Slides from course, Developing Applications for Android, CS4615, SZABIST, Karachi.

Citation preview

Page 1: Developing Applications for Android - Lecture#1

Developing Applications for Android

Muhammad Usman ChaudhrySZABIST CS4615

Lecture # 1

Page 2: Developing Applications for Android - Lecture#1

Today

● Course Introduction ● What will you learn?● Why learn android?● Prerequisites ● What I expect from you?● Grading ● Project & Other Requirements ● Book & Reference material● Android History, Overview & Evolution● Platform Architecture● Example Applications● Growth Comparison of Android with iOS & Other Mobile

Platforms

Muhammad Usman Chaudhry CS4615 SZABIST

Page 3: Developing Applications for Android - Lecture#1

Course Introduction

● 2 + 1 Credit Hours● 1 Class per week (Every Friday)● Highly Interactive

Muhammad Usman Chaudhry CS4615 SZABIST

Page 4: Developing Applications for Android - Lecture#1

What will you learn?

● Understand the complete android development architecture.

● Engineer beautiful, sleek & awesome android apps.

● Real life applications of Object Oriented Programming.

● Some wonderful design patterns● Many computer science concepts like,

Databases, Multimedia, Multithreading, Graphics, etc. applied in your apps.

Muhammad Usman Chaudhry CS4615 SZABIST

Page 5: Developing Applications for Android - Lecture#1

What will you learn?

● Create better applications with lower resources available (unlike desktop, web systems).

● Industry oriented Java standards, clean coding tips, etc.

Muhammad Usman Chaudhry CS4615 SZABIST

Page 6: Developing Applications for Android - Lecture#1

Why Learn Android?

● Run your applications on 59% of the smartphones worldwide equalling 331 million devices. (Jul - 2012)

● Join in 600,000 applications for android. (Jun - 2012)

● 20 billion app downloads so far● High average with around 500 downloads

per app. ● Not just smartphone, Android OS is being

used in, TVs, Microwaves, Car Tapes, etc.Muhammad Usman Chaudhry CS4615 SZABIST

Page 7: Developing Applications for Android - Lecture#1

Why Learn Android?

● High job success rates.● Don't want a job? Create app sell to market.

You maybe the next best startup.● Easy to show to your friend, take your

android out of your pocket and bam! You don't need computer now.

Muhammad Usman Chaudhry CS4615 SZABIST

Page 8: Developing Applications for Android - Lecture#1

Prerequisites

● Object-oriented programming. (Important)● You must understand terms like:

○ Class○ Instance○ Method○ Context○ Superclass/Subclass○ Interface/Protocols○ Delegates

● Basic understanding of design patterns

Muhammad Usman Chaudhry CS4615 SZABIST

Page 9: Developing Applications for Android - Lecture#1

Prerequisites

● If you haven't already written any programs where you had to create handful of classes then you'll need to work doubly hard to keep up the pace.

Muhammad Usman Chaudhry CS4615 SZABIST

Page 10: Developing Applications for Android - Lecture#1

What I Expect From You

● High punctuality● Focus & interest in class● On time assignments● Continuous feedback

Muhammad Usman Chaudhry CS4615 SZABIST

Page 11: Developing Applications for Android - Lecture#1

Grading System

● Assignments x 10● Quizzes x 15● Project x 20● Midterm x 20● Final x 35

Muhammad Usman Chaudhry CS4615 SZABIST

Page 12: Developing Applications for Android - Lecture#1

Project

● Can be pre-cursor to FYP● High grade points (more value)● 2 students per group● Emphasis will be over quality of product● Deliverable will be posted to Google Play

Store for public viewing with SZABIST account

Muhammad Usman Chaudhry CS4615 SZABIST

Page 13: Developing Applications for Android - Lecture#1

Other Requirements

● Join Google Group: ○ SZABIST-FALL2012-ANDROID

● Installation of Eclipse IDE & Android SDK Tools. (Before coming week).

● Install all SDKs preferably (2.1, 2.2 & 4).● An android device. (Optional but highly

recommended)

Muhammad Usman Chaudhry CS4615 SZABIST

Page 14: Developing Applications for Android - Lecture#1

Books

Textbook:● Beginning Android 4 by Grant Allen (Apress)

Reference:● http://developer.android.com/

Muhammad Usman Chaudhry CS4615 SZABIST

Page 15: Developing Applications for Android - Lecture#1

Android Overview & Evolution

1. Android history2. Basic technical specification3. Supported platforms for development

Muhammad Usman Chaudhry CS4615 SZABIST

Page 16: Developing Applications for Android - Lecture#1

1. Android History

● Started by Android Inc. in 2005, which had been financed by Google, though initial developer wasn't part of Google.

● In 2007 Google bought Android Inc. & also formed OHA (Open Handset Alliance).

● Android beta was released in Nov 2007.● Android v1.0 was released in Sep 2008.● HTC Dream had been first commercial

android device.● Current android version is 4.1 (Jellybeans).

Muhammad Usman Chaudhry CS4615 SZABIST

Page 17: Developing Applications for Android - Lecture#1

What is Open Handset Alliance?

● A consortium of 84 hardware, software and telecommunication companies.

● Devoted to advancing open standards for mobile devices.

● Include top names, ○ Acer, Dell, Fujitsu, HTC, LG, Motorola, Samsung, Toshiba, Sony, NEC, Asus, Lenovo,

Sharp, Huawei, ZTE and many more in handset manufacturers.

○ Intel, ARM, NVIDIA, MIPS, Texas Instruments and many other in semiconductors.

○ NTT Docomo, Sprint, T-mobile, Vodafone, Telus, China Mobile and others in mobile operators.

○ Google, eBay, SVOX, NXP, Access and others in software companies.

○ Accenture, Teleca, Wipro and many others in marketing or commercialization.

Muhammad Usman Chaudhry CS4615 SZABIST

Page 18: Developing Applications for Android - Lecture#1

2. Basic Technical Specs

● Linux based kernel● Open source model under Apache 2

liscence.● Supports ARM, MIPS & x86 architectures● Monolithic kernel● Programmed in C, C++, Python, Java.

Muhammad Usman Chaudhry CS4615 SZABIST

Page 19: Developing Applications for Android - Lecture#1

What is monolithic kernel?

Muhammad Usman Chaudhry CS4615 SZABIST

Page 20: Developing Applications for Android - Lecture#1

3. Development Platforms

● Supported OS for Android Development:○ Windows XP(32-bit), Vista or 7(32 or 64-bit)○ MacOSX 10.5.8 or later (x86 only)○ Linux (Ubuntu, Lucid Lynx)

■ glibc 2.7■ 32-bit■ In case of ubuntu version must be greater than

8.04● IDEs

○ Eclipse IDE with JDT (Highly recommended)○ Netbeans IDE (Via Android plugin)○ IntelliJ IDEA (Still in early preview stage)

Muhammad Usman Chaudhry CS4615 SZABIST

Page 21: Developing Applications for Android - Lecture#1

Android Architecture

● Android Ecosystem is composed of following 4 items:○ Linux Kernel○ Libraries○ Applications Framework○ Applications

● Pictorial representation in next slide will clear it up more.

Muhammad Usman Chaudhry CS4615 SZABIST

Page 22: Developing Applications for Android - Lecture#1

Android Architecture

Page 23: Developing Applications for Android - Lecture#1

Linux Kernel

● Its customized linux kernel with a lot more android specific code to support devices.

● Driver written for one version of android (like 2.3.5 for instance) won't necessarily work with other versions (4.0 for instance).

● One of the kernel's main function is to control hardware.

Muhammad Usman Chaudhry CS4615 SZABIST

Page 24: Developing Applications for Android - Lecture#1

Linux Kernel

● You could re-compile the android kernel if you want to.

● Advantage of tweaking the kernel can result in higher optimized speeds or optimized battery power, depending upon which governor you select, you must exactly know what you're doing.

● Tweaking android kernel is something you could do in your spare time and see how amazingly you can manipulate hardware.

Muhammad Usman Chaudhry CS4615 SZABIST

Page 25: Developing Applications for Android - Lecture#1

Libraries

Muhammad Usman Chaudhry CS4615 SZABIST

Page 26: Developing Applications for Android - Lecture#1

Libraries

● C/C++ Libraries (Bionic libc):○ Derivation of standard C library○ Specifically targeted for Android○ Much smaller than libc & uClibc○ High speed as its designed for low clock-cycle

oriented CPUs○ Lacks many features of original libc (eg. Exception

handling etc.)○ Can be directly extended or accessed using Android

NDK (Native Development Kit).

Muhammad Usman Chaudhry CS4615 SZABIST

Page 27: Developing Applications for Android - Lecture#1

Libraries

● LibWebCore:○ Modern web browser engine used in both webview

as well as native browser.○ Support CSS, Javascript, DOM, Ajax etc.

● Media framework:○ PacketVideo, openCORE platform.○ Support Audio, Video, Still-frame formats.

● SQLite:○ Self-contained○ Serverless○ Zero-configuration○ SQL Database

Muhammad Usman Chaudhry CS4615 SZABIST

Page 28: Developing Applications for Android - Lecture#1

Libraries

● OpenGL|ES(openGL for Embedded Systems):○ Standard specification for 2D/3D graphics○ Can simulate physics○ Complex 3D scenes can be drawn○ Used in:

■ Virtual reality■ Augmented reality■ Game programming■ Scientific visualization■ Flight simulation

Muhammad Usman Chaudhry CS4615 SZABIST

Page 29: Developing Applications for Android - Lecture#1

Libraries

● Surface Manager:○ Manages access to display subsystem○ Seamlessly composites graphic layers 2D/3D layers

from different applications● SGL (Skia graphic library):

○ An underlying 2D graphics engine○ Used to draw text, geometries & images

● SSL (Secure Sockets Layer):○ Cryptographic protocol to provide information

security over internet.

Muhammad Usman Chaudhry CS4615 SZABIST

Page 30: Developing Applications for Android - Lecture#1

Libraries

● FreeType:○ Bitmap and vector font rendering.

Muhammad Usman Chaudhry CS4615 SZABIST

Page 31: Developing Applications for Android - Lecture#1

Android Runtime

Muhammad Usman Chaudhry CS4615 SZABIST

Page 32: Developing Applications for Android - Lecture#1

Dalvik Virtual Machine

● Custom implementation of virtual machine for android:○ Provides application portability and runtime

consistency.○ Runs optimized file format (.dex) and Dalvik

bytecode.○ Java .class/.jar files are converted to .dex at build

time.

Muhammad Usman Chaudhry CS4615 SZABIST

Page 33: Developing Applications for Android - Lecture#1

Dalvik Vs Java Virtual Machine

Dalvik VM Java VMIt is a register machine. It is a stack machine.

More closely resembles actual hardware design.

Rely on excessive copying of values and larger instruction set.

Produces Dalvik Executable. Produces Java Bytecode.

Owned & maintaned by Google Inc.

Maintained by Oracle.

Muhammad Usman Chaudhry CS4615 SZABIST

Page 34: Developing Applications for Android - Lecture#1

Core Libraries

● Core APIs for Java language, yet simple and familiar development platforms○ Data structures○ File Access○ Graphics○ Network Access○ Utilities

● All major APIs available under J2SE are available under android plus its own libraries.

Muhammad Usman Chaudhry CS4615 SZABIST

Page 35: Developing Applications for Android - Lecture#1

Applications Framework

Muhammad Usman Chaudhry CS4615 SZABIST

Page 36: Developing Applications for Android - Lecture#1

Application Framework

● Activity Manager:○ Interact with overall activities running in the system.○ Manage lifecycle of activities.○ Manage stacking of activities.

● Window Manager:○ Dispatch input events to clients.○ Transition animation.○ Create layout/surfaces (using SurfaceManager).

● Content Providers:○ Manage access to structured access of data.○ Mainly used for data sharing purposes.

Muhammad Usman Chaudhry CS4615 SZABIST

Page 37: Developing Applications for Android - Lecture#1

Application Framework

● View System:○ Basic building block for UI components.○ Can be extended to build custom UI components.

● Package Manager:○ Provides methods for querying and manipulating

installed packages.● Telephony Manager:

○ Provides access to telephony services on android.○ Can monitor telephone state changes.

Muhammad Usman Chaudhry CS4615 SZABIST

Page 38: Developing Applications for Android - Lecture#1

Application Framework

● Location Manager:○ Provide access to system location services.○ Able to track location periodically or one-time.

● Resource Manager:○ Link external resources to native app at build time.○ Resources may include XML Layouts, Bitmaps, raw

files etc.● Notification Manager:

○ Notify users about events.

Muhammad Usman Chaudhry CS4615 SZABIST

Page 39: Developing Applications for Android - Lecture#1

Applications

Muhammad Usman Chaudhry CS4615 SZABIST

Page 40: Developing Applications for Android - Lecture#1

Example Applications

● Following applications are to show you what sort of applications can be made for android and how you can utilize features of this platform to create innovative and powerful applications.

Muhammad Usman Chaudhry CS4615 SZABIST

Page 41: Developing Applications for Android - Lecture#1

Augmented Reality - Live

● Let's have a look at live example of Augmented reality application.

Muhammad Usman Chaudhry CS4615 SZABIST

Page 42: Developing Applications for Android - Lecture#1
Page 43: Developing Applications for Android - Lecture#1
Page 44: Developing Applications for Android - Lecture#1
Page 45: Developing Applications for Android - Lecture#1
Page 46: Developing Applications for Android - Lecture#1

Android Vs Other Platforms

Option Android iPhone WMNFC (Near Field Communication) YES NO NO

ADK (Accessory Development Kit) YES YES (iOS5+) NO

Multitasking YES YES (iOS4+) YES

Call Control YES YES (Jailbreak only) NO

High Performance Computing YES YES NO

Interface Customization YES NO NO

Firmware Upgrade YES YES YES

Muhammad Usman Chaudhry CS4615 SZABIST

Page 47: Developing Applications for Android - Lecture#1

Detailed Insights

Muhammad Usman Chaudhry CS4615 SZABIST

Page 48: Developing Applications for Android - Lecture#1

Detailed Insights

Muhammad Usman Chaudhry CS4615 SZABIST

Page 49: Developing Applications for Android - Lecture#1

Conclusion

● Android is a strong platform to develop on with growth rate expected to reach peaks this year.

● More than half of the smartphone market is covered by Android making it more than 25% of the total mobile phone market share holder.

Muhammad Usman Chaudhry CS4615 SZABIST

Page 50: Developing Applications for Android - Lecture#1

Next Class

● Complete Java Review will revisit OOP concepts.● Design patterns which will be used in android

development.

Muhammad Usman Chaudhry CS4615 SZABIST

Page 51: Developing Applications for Android - Lecture#1

Questions

● Any Questions?

Muhammad Usman Chaudhry CS4615 SZABIST