Developing Applications for Android - Lecture#1


Published on

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

Published in: Technology
1 Like
  • Be the first to comment

No Downloads
Total views
On SlideShare
From Embeds
Number of Embeds
Embeds 0
No embeds

No notes for slide

Developing Applications for Android - Lecture#1

  1. 1. Developing Applications for Android Muhammad Usman Chaudhry SZABIST CS4615 Lecture # 1
  2. 2. 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 PlatformsMuhammad Usman Chaudhry CS4615 SZABIST
  3. 3. Course Introduction ● 2 + 1 Credit Hours ● 1 Class per week (Every Friday) ● Highly InteractiveMuhammad Usman Chaudhry CS4615 SZABIST
  4. 4. 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
  5. 5. 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
  6. 6. 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
  7. 7. Why Learn Android? ● High job success rates. ● Dont 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 dont need computer now.Muhammad Usman Chaudhry CS4615 SZABIST
  8. 8. Prerequisites ● Object-oriented programming. (Important) ● You must understand terms like: ○ Class ○ Instance ○ Method ○ Context ○ Superclass/Subclass ○ Interface/Protocols ○ Delegates ● Basic understanding of design patternsMuhammad Usman Chaudhry CS4615 SZABIST
  9. 9. Prerequisites ● If you havent already written any programs where you had to create handful of classes then youll need to work doubly hard to keep up the pace.Muhammad Usman Chaudhry CS4615 SZABIST
  10. 10. What I Expect From You ● High punctuality ● Focus & interest in class ● On time assignments ● Continuous feedbackMuhammad Usman Chaudhry CS4615 SZABIST
  11. 11. Grading System ● Assignments x 10 ● Quizzes x 15 ● Project x 20 ● Midterm x 20 ● Final x 35Muhammad Usman Chaudhry CS4615 SZABIST
  12. 12. 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 accountMuhammad Usman Chaudhry CS4615 SZABIST
  13. 13. 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
  14. 14. Books Textbook: ● Beginning Android 4 by Grant Allen (Apress) Reference: ● Usman Chaudhry CS4615 SZABIST
  15. 15. Android Overview & Evolution 1. Android history 2. Basic technical specification 3. Supported platforms for developmentMuhammad Usman Chaudhry CS4615 SZABIST
  16. 16. 1. Android History ● Started by Android Inc. in 2005, which had been financed by Google, though initial developer wasnt 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
  17. 17. 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
  18. 18. 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
  19. 19. What is monolithic kernel?Muhammad Usman Chaudhry CS4615 SZABIST
  20. 20. 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
  21. 21. 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
  22. 22. Android Architecture
  23. 23. 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) wont necessarily work with other versions (4.0 for instance). ● One of the kernels main function is to control hardware.Muhammad Usman Chaudhry CS4615 SZABIST
  24. 24. 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 youre 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
  25. 25. LibrariesMuhammad Usman Chaudhry CS4615 SZABIST
  26. 26. 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
  27. 27. 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 DatabaseMuhammad Usman Chaudhry CS4615 SZABIST
  28. 28. 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 simulationMuhammad Usman Chaudhry CS4615 SZABIST
  29. 29. 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
  30. 30. Libraries ● FreeType: ○ Bitmap and vector font rendering.Muhammad Usman Chaudhry CS4615 SZABIST
  31. 31. Android RuntimeMuhammad Usman Chaudhry CS4615 SZABIST
  32. 32. 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
  33. 33. Dalvik Vs Java Virtual Machine Dalvik VM Java VM It is a register machine. It is a stack machine. More closely resembles actual Rely on excessive copying of hardware design. values and larger instruction set. Produces Dalvik Executable. Produces Java Bytecode. Owned & maintaned by Google Maintained by Oracle. Inc.Muhammad Usman Chaudhry CS4615 SZABIST
  34. 34. 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
  35. 35. Applications FrameworkMuhammad Usman Chaudhry CS4615 SZABIST
  36. 36. 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
  37. 37. 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
  38. 38. 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
  39. 39. ApplicationsMuhammad Usman Chaudhry CS4615 SZABIST
  40. 40. 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
  41. 41. Augmented Reality - Live ● Lets have a look at live example of Augmented reality application.Muhammad Usman Chaudhry CS4615 SZABIST
  42. 42. Android Vs Other Platforms Option Android iPhone WMNFC (Near Field Communication) YES NO NOADK (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 YESMuhammad Usman Chaudhry CS4615 SZABIST
  43. 43. Detailed InsightsMuhammad Usman Chaudhry CS4615 SZABIST
  44. 44. Detailed InsightsMuhammad Usman Chaudhry CS4615 SZABIST
  45. 45. 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
  46. 46. Next Class ● Complete Java Review will revisit OOP concepts. ● Design patterns which will be used in android development.Muhammad Usman Chaudhry CS4615 SZABIST
  47. 47. Questions ● Any Questions?Muhammad Usman Chaudhry CS4615 SZABIST