Hello Android - Pune GTUG

Embed Size (px)

DESCRIPTION

Presentation for Pune GTUG session on 6th June, 2009

Citation preview

  • 1. Hello Android!
      • PuneGTUG on 6 thJune, 2009
    • by Sushrut Bidwai
    • Copyright 2008 Wissen Systems. All rights reserved

2. Agenda

  • Brief history of Android
  • Android phones
  • Android experiments
  • What is Android?
  • What's in new SDK?
  • Android architecture in detail
  • Application fundamentals
  • User interface
  • Resources and assets
  • Data storage
  • Content providers
  • Security and permissions
  • Developing with Eclipse
  • First Android application
  • Copyright 2008 Wissen Systems. All rights reserved

3. Brief history of Android

  • Developed by a small unknown company, Android Inc
  • Google acquired this company in 2005
  • Later Google opened up to form, Open handset alliance (OHA)
  • OHA consists of
    • Google
    • HTC
    • T-mobile
    • Sprint
    • China mobile, Telecom Italia etc
    • Vodafone, LG, Samsung, Motorola
    • ARM, Intel
    • Many others
  • Copyright 2008 Wissen Systems. All rights reserved

4. Android phones

  • T-Mobile G1 or HTC Dream, first mobile with Android.
  • HTC Magic
  • HKC Pearl
  • HKC Imobile
  • Samsung launching a new mobile with Android
  • Copyright 2008 Wissen Systems. All rights reserved

5. What is Android?

  • Software stack, not an operating system
  • Linux is the operating system under Android
  • Provides application programming interface through Java/Dalvik virtual machine (DVM)
  • Dalvik hides OS complexities from app programmer, who can write apps in (best programming language :-) ) Java
  • Jxyz can be ported, or already ported, to run on DVM
  • Provides utilities and libraries like modern web browser, media support, GSM telephony and lot of other things like OpenGL, Location support.
  • My thoughts Android is Linux based platform, customized to run on mobile/handheld devices which have limited processing power and memory. These devices will run many apps/utilities, one of them being GSM telephony.
  • Ideal target for Netbooks
  • Copyright 2008 Wissen Systems. All rights reserved

6. What's new SDK?

  • Latest version available is 1.5, known as cupcake.
  • Rumours already loud about donut release ie 2.0, with which LOT of new handsets are expected to come
  • Features for programmer -
    • Locale support
    • Media framework api changes
    • Application defined hardware requirements
    • Speech recognition
    • Lot of other smaller changes
  • Copyright 2008 Wissen Systems. All rights reserved

7. Android architecture

  • Copyright 2008 Wissen Systems. All rights reserved

8. Android architecture details

  • Linux kernel
    • Version 2.6, currently used
    • Provides abstraction layer between hardware and rest of the stack
    • Security, memory management, process management, network stack, driver model
  • Libraries
    • Libc port variants
    • Media libraries for audio, video, images
    • Surface manager for touch screen
    • LibWebCore, modern web browser
    • SGL, 2D graphics engine
    • FreeType, bitmap and vector fonts
    • SQLite
  • Copyright 2008 Wissen Systems. All rights reserved

9. Android architecture details...

  • Android runtime
    • DVM and core libraries
    • Every android process runs its own process and VM instance
    • DVM optimized to run multiple Vms efficiently
    • .dex format for minimal memory footprint
    • Depends on kernel for threading, low level memory management etc
  • Application framework
    • Typical framework, which makes writing apps easier
  • Applications
    • All applications including, apps packaged with android platform
    • All apps are equal
  • Copyright 2008 Wissen Systems. All rights reserved

10. Application fundamentals

  • AndroidManifest.xml
  • Written as Java applications
  • Applications live in their own world, separate process, VM, userId
  • Ways to share userId
  • Folder structure
  • Components
    • Activities
    • Services
    • Broadcast receivers
    • Content providers
  • Again all applications are equal
  • Copyright 2008 Wissen Systems. All rights reserved

11. Activity

  • Presents visual interface
  • Each user interface is separate activity.
  • Implemented by subclassing Activity class
  • Modal dialogs and floating activities
  • Activity state
  • Droiddraw and hierarchyviewer
  • Copyright 2008 Wissen Systems. All rights reserved

12. Service

  • Background processes
  • Works when user is using some other app.
  • Long living component
  • Implemented by subclassing Service class
  • Requires intent to activate
  • Registered in androidmanifest.xml
  • Bound services, not long living, lives through the context only
  • Communication with bound services through serviceconnection
  • Services run in app process, can be setup to run in their own process
  • Communication with remote process through AIDL. (Corba/RMI like)
  • Permissions can be setup in manifest file
  • Copyright 2008 Wissen Systems. All rights reserved

13. Broadcast Receiver

  • Event handling, also known as intent receiver
  • All communication is managed through intents
  • ExtendsBroadcastReceiverclass to implement
  • Entry in manifest or dynamically registered through context class
  • Broadcast intent withsendBroadCastorsendOrderedBroadCast
  • Permissions very important, specially for platform developers.
  • Copyright 2008 Wissen Systems. All rights reserved

14. Content providers

  • Way of sharing data between processes/apps
  • Remember each app data is stored separately and lost after app is uninstalled.
  • A content provider class implements standard set of methods to expose its app data to be used/consumed/created by other apps
  • Supports CRUD operations
  • Standard content providers, like contacts, files, media library provided in platform through core applications
  • REST like implementation where every data object is a URI
  • Copyright 2008 Wissen Systems. All rights reserved

15. Broadcast Receiver

  • Event handling, also known as intent receiver
  • All communication is managed through intents
  • ExtendsBroadcastReceiverclass to implement
  • Entry in manifest or dynamically registered through context class
  • Broadcast intent withsendBroadCastorsendOrderedBroadCast
  • Permissions very important, specially for platform developers.
  • Copyright 2008 Wissen Systems. All rights reserved

16. User Interface

  • Built using View and ViewGroup
  • Activities UI is constricted using nodes of View and ViewGroup object
  • Widget A View object which serves as interaction with user. Buttons etc
  • UI Events are handled using EventListners like onTouchListner, onClickListner
  • Menu are also defined using View hierarchy, but programmer doesn't define own structure.
  • Menu also have their own event handling callbacks
  • Copyright 2008 Wissen Systems. All rights reserved

17. Resources and Assets

  • Resources and assets are external elements that you want use and reference in your application
  • Examples Audio, Video, Images etc
  • Resources are available through R class, compiled by Android
  • Assets are accessible through AssetManager as byte streams
  • Standard set of resources are available to reference in your application
  • Copyright 2008 Wissen Systems. All rights reserved

18. Thank you! P lease send your feedback to[email_address]

  • Copyright 2008 Wissen Systems. All rights reserved