Introduction of android


Published on

Slide อบรม Introduction to Android

Published in: Education, Technology
  • Be the first to comment

  • Be the first to like this

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

No notes for slide

Introduction of android

  1. 1. 12/1/2011 Mobile Application Development with ANDROID Piya Sankhati ( Jenk ) Agenda Mobile Application Development (MAD) Intro to Android platform Platform architecture Application building blocks Development tools Hello Android ResourcesPresent at Business Computer @Sci NorthChiang Mai 1
  2. 2. 12/1/2011 Mobile Applications Mobile Apps are apps or services that can be pushed to a mobile device or downloaded and installed locally. Classification • Browser-based: apps/services developed in a markup language • Native: compiled applications (device has a runtime environment). Interactive apps such as downloadable games. • Hybrid: the best of both worlds (a browser is needed for discovery) What is Android Android is an open source operating system, created by Google specifically for use on mobile devices (cell phones and tablets) Linux based (2.6 kernel) Can be programmed in C/C++ but most app development is done in Java (Java access to C Libraries via JNI (Java Native Interface)) Supports Bluetooth, Wi-Fi, and 3G and 4G networkingPresent at Business Computer @Sci NorthChiang Mai 2
  3. 3. 12/1/2011 Why Android? Open source Lots of samples Popular Free to develop JAVA based Easily shared The Android Software StackPresent at Business Computer @Sci NorthChiang Mai 3
  4. 4. 12/1/2011 Linux Kernel • Works as a HAL • Device drivers • Memory management • Process management • Networking Libraries • C/C++ libraries • Interface through Java • Surface manager – Handling UI Windows • 2D and 3D graphics • Media codecs, SQLite, Browser enginePresent at Business Computer @Sci NorthChiang Mai 4
  5. 5. 12/1/2011 Android Runtime • Dalvik VM – Dex files – Compact and efficient than class files – Limited memory and battery power • Core Libraries – Java 5 Std edition – Collections, I/O etc… Application Framework • API interface • Activity manager – manages application life cycle.Present at Business Computer @Sci NorthChiang Mai 5
  6. 6. 12/1/2011 Applications • Built in and user apps • Can replace built in apps Android Application Development Android Eclipse IDE SDK Android Android Mobile Emulator DevicePresent at Business Computer @Sci NorthChiang Mai 6
  7. 7. 12/1/2011 Android development Java Source Android Manifest Generated Java .dex Dalvik Class Compiler File VM Resource XML Android Libraries Android Application Types Foreground applications need cool UIs (sudoku) Background services & intent receivers little to no user input (back-up assistant) Intermittent applications combination of visible & invisible (music) Widgets dynamic data displays (date/time)Present at Business Computer @Sci NorthChiang Mai 7
  8. 8. 12/1/2011 Foreground applications Background ServicePresent at Business Computer @Sci NorthChiang Mai 8
  9. 9. 12/1/2011 Intermittent applications Home Screen WidgetPresent at Business Computer @Sci NorthChiang Mai 9
  10. 10. 12/1/2011 Pre-installRequirements JDK 5 or JDK 6 (JAVA DevelopementKit) dex.html Eclipse 3.3 orlater ADT Plugin for Eclipse Android SDK EmulatororAndroiddevice Introduction (cont.) Design Considerations: Low processing speed Optimize code to run quick and efficiently Limited storage and memory Minimize size of applications; reuse and share data Limited bandwidth and high latency Design your application to be responsive to a slow (sometimes non- existent), intermittent network connection Limited battery life Avoid expensive operations Low resolution, small screen size “Compress” the data you want to displayPresent at Business Computer @Sci NorthChiang Mai 10
  11. 11. 12/1/2011 Application Components and Lifecycle Components of your application: Activities Presentation layer for the application you are building For each screen you have, their will be a matching Activity An Activity uses Views to build the user interface Services Components that run in the background Do not interact with the user Can update your data sources and Activities, and trigger specific notifications Android Application Overview (cont.) Components of your application: Content Providers Manage and share application databases Intents Specify what intentions you have in terms of a specific action being performed Broadcast Receivers Listen for broadcast Intents that match some defined filter criteria Can automatically start your application as a response to an intentPresent at Business Computer @Sci NorthChiang Mai 11
  12. 12. 12/1/2011 Android Application Overview (cont.) Application Lifecycle To free up resources, processes are being killed based on their priority: Critical Priority: foreground (active) processes Foreground activities; components that execute an onReceive event handler; services that are executing an onStart, onCreate, or onDestroy event handler. High Priority: visible (inactive) processes and started service processes Partially obscured activity (lost focus); services started. Low Priority: background processes Activities that are not visible; activities with no started service Application Components and Lifecycle (cont.) Activity Lifecycle: Activities are managed as an activity stack (LIFO collection) Activity has four states: Running: activity is in the foreground Paused: activity has lost focus but it is still visible Stopped: activity is not visible (completely obscured by another activity) Inactive: activity has not been launched yet or has been killed.Present at Business Computer @Sci NorthChiang Mai 12
  13. 13. 12/1/2011 Application Components and Lifecycle (cont.) Source: Activity Lifecycle public class Activity extends ApplicationContext { // full lifetime protected void onCreate(BundlesavedInstanceState); // visible lifetime protected void onStart(); protected void onRestart(); // active lifetime protected void onResume(); protected void onPause(); protected void onStop(); protected void onDestroy(); }Present at Business Computer @Sci NorthChiang Mai 13
  14. 14. 12/1/2011 IntentReceivers 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.. System matches Intent with Activity that can best provide the service Activities and IntentReceivers describe what Intents they can servicePresent at Business Computer @Sci NorthChiang Mai 14
  15. 15. 12/1/2011 Intents Home Picasa Photo Gallery Contacts “Pick photo” GMail Client component makes a Chat System picks best component request for a specific action New components can use for that action Blogger Blogger existing functionality Services Faceless components that run in the background E.g. music player, network download etc…Present at Business Computer @Sci NorthChiang Mai 15
  16. 16. 12/1/2011 ContentProviders Enables sharing of data across applications E.g. address book, photo gallery Provides uniform APIs for: querying delete, update and insert. Content is represented by URI and MIME type Fundamental Coding Concepts interface vs. processing separation is key!!! android app interface: res files ○ layout *.xml to define views ○ values *.xml to define strings, menus ○ drawable *.png to define images android app processing: src *.java event based programming javascript example?Present at Business Computer @Sci NorthChiang Mai 16
  17. 17. 12/1/2011 Application Manifest master .xml file declares all the components of the application declares intent filters for each component declares external app info: name, icon, version, SDK levels, permissions, required configurations and device features, etc. est/manifest-intro.html Day 4 Creating a New Application I Create Project File -> New -> Project -> Android -> Android Project New Project Wizard to specify project name – file folder check/change location choose lowest level build target application name – friendly description package name – 2 part java namespace create activity – main activity component min SDK – lowest level that app will run on Day 4Present at Business Computer @Sci NorthChiang Mai 17
  18. 18. 12/1/2011 Creating a New Application II Create Launch Configuration project and activity to launch virtual device and emulator options input/output settings Day 4 Creating a New Application Run, Edit, Debug III debug & run default Hello World activity cmd-shift-O to import necessary classes in Eclipse select project, right click, Android Tools -> Fix Project Properties edit the starting activity implement new components and behaviors (borrow from samples) select the project and then Run -> Run As -> Android Application Day 4Present at Business Computer @Sci NorthChiang Mai 18
  19. 19. 12/1/2011 User Interfaces GOOD BAD intuitive overcrowding clean too complicated simple poor aesthetics elegant lack of response, feedback right level of information pop-ups fast physically unwieldy Day 1 HCI, UX, UI, oh my! HCI: human computer interaction UI: User Interface GUI: Graphical User Interface UX: User Experience Day 1Present at Business Computer @Sci NorthChiang Mai 19
  20. 20. 12/1/2011 Reference http://www.github.comPresent at Business Computer @Sci NorthChiang Mai 20