Android Final 2

Embed Size (px)

Citation preview

  • 8/2/2019 Android Final 2

    1/65

    Introduction

    to

    Android

  • 8/2/2019 Android Final 2

    2/65

    MOBILE O.SSome of the popular operating systems used in

    mobile gadgets are given below.

    1. Symbian Nokia

    Windows Phone

    2. iOS Apple

    3. Blackberry O.S Blackberry

    4. Android Many Handsetmanufacturers

  • 8/2/2019 Android Final 2

    3/65

    WHAT IS ANDROID?

    Android is a software stack for mobile

    devices that includes an operating system,middleware and key applications

  • 8/2/2019 Android Final 2

    4/65

    GOOGLE

    We want the next killer application to be written

    for cell phones

    - Andy Rubin, Google

  • 8/2/2019 Android Final 2

    5/65

    GOOGLE BUYSANDROID

  • 8/2/2019 Android Final 2

    6/65

    OPEN HANDSET ALLIANCE

  • 8/2/2019 Android Final 2

    7/65

    OPEN HANDSETALLIANCE

    It's a consortium of several companies

    Devoted to advancing open standards formobile devices

    Develop technologies that will significantly

    lower the cost of developing anddistributing mobile devices and services

  • 8/2/2019 Android Final 2

    8/65

    ANDROID SDK

  • 8/2/2019 Android Final 2

    9/65

    T-MOBILE G1

    September 2008

  • 8/2/2019 Android Final 2

    10/65

    October 22, 2008

    Retail launch

  • 8/2/2019 Android Final 2

    11/65

    G1 TECHNICAL SPECS

    ROM 256 MB

    RAM 192 MB

    4.60 in x 2.16 in x 0.62 in

    158 grams

    3G (HSDPA)

    Touch screen, HVGA 320x480

    3.2 megapixel camera

    Micro-SD expansion slot

    GPS, compass, accelerometer

  • 8/2/2019 Android Final 2

    12/65

    THIRD PARTYAPPLICATIONS

  • 8/2/2019 Android Final 2

    13/65

    ANDROID APPLICATIONS

    Multiple applications, running simultaneously

    User may switch between running applications

    Background services

    Supports three Orientations

    Has access to wi-fi, phone state, audio settings,external memory access.

  • 8/2/2019 Android Final 2

    14/65

    GOOGLES MASTER PLAN

    Make the cloud more Accessible

    Keep connectivity Pervasive

    Make the client more Powerful

  • 8/2/2019 Android Final 2

    15/65

    GOOGLES MASTER PLAN

  • 8/2/2019 Android Final 2

    16/65

    DISTRIBUTING ANDROID APPS

    Android Market

    Self-publish on your own web site

    Use a 3rd party application store

  • 8/2/2019 Android Final 2

    17/65

    ANDROID MARKET

  • 8/2/2019 Android Final 2

    18/65

    ANDROID MARKET

    $25 registration fee for developers

    developer receives 70% of each sale

    remaining amount goes to carriers

    Google does not take a percentage

    http://www.android.com/market/

  • 8/2/2019 Android Final 2

    19/65

    MARKET GOT YOU DOWN? Market got you down?

    upload APK to your own web server

    http://icecondor.com/download/icecondor-2008-10-26.apk

    use correct MIME type

    application/vnd.android.package-archive

    http://icecondor.com/download/icecondor-2008-10-26.apkhttp://icecondor.com/download/icecondor-2008-10-26.apkhttp://icecondor.com/download/icecondor-2008-10-26.apkhttp://icecondor.com/download/icecondor-2008-10-26.apkhttp://icecondor.com/download/icecondor-2008-10-26.apkhttp://icecondor.com/download/icecondor-2008-10-26.apkhttp://icecondor.com/download/icecondor-2008-10-26.apkhttp://icecondor.com/download/icecondor-2008-10-26.apkhttp://icecondor.com/download/icecondor-2008-10-26.apk
  • 8/2/2019 Android Final 2

    20/65

    IPHONE VS ANDROID !?

  • 8/2/2019 Android Final 2

    21/65

  • 8/2/2019 Android Final 2

    22/65

  • 8/2/2019 Android Final 2

    23/65

  • 8/2/2019 Android Final 2

    24/65

  • 8/2/2019 Android Final 2

    25/65

  • 8/2/2019 Android Final 2

    26/65

  • 8/2/2019 Android Final 2

    27/65

    6) COST

  • 8/2/2019 Android Final 2

    28/65

  • 8/2/2019 Android Final 2

    29/65

    STATISTICS

  • 8/2/2019 Android Final 2

    30/65

    STATISTICS

  • 8/2/2019 Android Final 2

    31/65

    ANDROID ENABLEDFRIDGE ------------>

    ANDROID ENABLED

    WATCH

  • 8/2/2019 Android Final 2

    32/65

    SYSTEM ARCHITECTURE

  • 8/2/2019 Android Final 2

    33/65

    LINUX KERNEL Android relies on Linux version 2.6 for core

    system services, acts as a layer betweenhardware and software.

    Manages the following; Security

    Memory management

    Process management Network stack

    Driver model

  • 8/2/2019 Android Final 2

    34/65

    DALVIK VM

    Not a Java VM

    Design constraints: slow CPU, little RAM

    Will run on OS without swap space

    On compiling .class files will be changed to .dex format

    The .dex format runs on the Dalvik platform.

  • 8/2/2019 Android Final 2

    35/65

    LIBRARIESA set of C/C++ libraries used by various components of the

    Android system.

    Some of the core libraries are listed below: System C library - an implementation of the standard C

    system library (libc), tuned for embedded Linux-based devices Media Libraries - the libraries support playback and recording

    of many popular audio, video and image formats . Surface Manager - manages access to the display subsystem

    and seamlessly composites 2D and 3D graphic LibWebCore - a modern web browser engine which powers

    both the Android browser and an embeddable web view SGL - the underlying 2D graphics engine FreeType - bitmap and vector font rendering SQLite - a powerful and lightweight relational database

    engine available to all applications

  • 8/2/2019 Android Final 2

    36/65

    APPLICATION FRAMEWORK Activity Manager : Maintains the activities/screens of the applicationsthat are displayed

    Window Manager: Co-ordinates the orientation of phone, sensors etc.

    Content : Manages the data to be transferred between

    Manager Activities / screens View System : Controls the various layouts, button

    and UI level objects

    Notification : Deals with the display of AlertBox, Toast msgs.

    Manager

    Telephony : Handles the process like call, sms, mms etc.Manager

    Location : Uses Google Maps to access location related info

    Manager

  • 8/2/2019 Android Final 2

    37/65

    NETWORK CONNECTIVITY

    It supports wireless communications using

    GSM mobile-phone technology

    3G

    802.11 Wi-Fi networks

    Integrated Browser

  • 8/2/2019 Android Final 2

    38/65

    APPLICATION APISUI

    android.widget.*

    android.view.*

    android.graphics.*

    android.app.Activity etc

    PhoneState

    android.content.res.Configuration

    android.hardware.Sensor

    android.net.wifi.WifiManager

    Telephony

    android.telephony.TelephonyManager

    android.telephony.SmsManager

  • 8/2/2019 Android Final 2

    39/65

    APPLICATION APIS

    Web android.webkit.WebView

    Cameraandroid.hardware.CameraDevice

    Local database android.database.*

    Mapscom.google.android.maps.MapView

    Locationandroid.location.LocationManager

    Multimedia android.media.MediaPlayer

    *

  • 8/2/2019 Android Final 2

    40/65

    API LEVELS

    API Level is an integer value that uniquely identifiesthe framework API revision offered by a version of theAndroid platform:

    Android 2.3

    (Gingerbread) 9/10

    Android 2.2(Froyo)

    8

    Android 2.0/2.1(Eclair)

    7

    Android 1.6(Donut)

    4

    Android 1.5(Cupcake)

    3

  • 8/2/2019 Android Final 2

    41/65

    DEVELOPMENT TOOLS

    Android SDK

    Eclipse plugin

    Android emulator

    Command line tools

    Documentation

    Debugging tools

    Android NDK Android PDK

  • 8/2/2019 Android Final 2

    42/65

    ANDROID SOFTWARE DEVELOPMENTEssential for the development of applications on android environment.

    Consists of the emulator, documentation, debugging tools and command line

    Also requires ADT plugin for merging with eclipse.

    Steps you must follow to set up the Android SDK:

    Prepare your development computer and ensure it meets thesystem requirements.

    Install the SDK starter package from the table above. (If you're on

    Windows, download the installer for help with the initial setup.)

    Install the ADT plugin for Eclipse (if you'll be developing in Eclipse).

    Add Android platforms and other components to your SDK.Installers available at :

    http://developer.android.com/sdk/index.html,

    http://developer.android.com/sdk/eclipse-

    adt.html#installing

    http://developer.android.com/sdk/index.htmlhttp://developer.android.com/sdk/eclipse-adt.htmlhttp://developer.android.com/sdk/eclipse-adt.htmlhttp://developer.android.com/sdk/eclipse-adt.htmlhttp://developer.android.com/sdk/eclipse-adt.htmlhttp://developer.android.com/sdk/eclipse-adt.htmlhttp://developer.android.com/sdk/eclipse-adt.htmlhttp://developer.android.com/sdk/eclipse-adt.htmlhttp://developer.android.com/sdk/index.html
  • 8/2/2019 Android Final 2

    43/65

    ANDROID NATIVE DEVELOPMENTNDK is a companion tool to the Android SDK that letsyou build performance-critical portions of your apps in

    native code.The NDK provides: A set of tools and build files used to generate nativecode libraries from C and C++ sources A way to embed the corresponding native librariesinto application packages files (.apks) that can bedeployed on Android devices A set of native system headers and libraries that willbe supported in all future releases of the Android

    platform.Some of the needed Android source code packagesavailable in http://android.git.kernel.org/ are:1) Android.platform.bionic,2) Android.platform.build,

    3) Android.platform.system.core, and

  • 8/2/2019 Android Final 2

    44/65

    ANDROID PLATFORM DEVELOPMENT Designed for platform developers and manufacturers building

    Android-powered devices. Manages the porting of android operating system into a device

    that matches requirements

    Allows the developer to alter based on their device

    Following are the main steps for porting Android:

    Download the patches for Android

    Update RIL (Radio Interface Library) for target platform

    Update Board specific components such as Codec, Camera,

    Audio, Wifi, Power Management, Bluetooth etc. Compile Android source code

    Burn system image on Target platform

  • 8/2/2019 Android Final 2

    45/65

    ANDROID DEBUG BRIDGEA versatile tool lets you manage the state of an emulator instance or

    Android-powered device.

    It is a client-server program that includes three components:

    A client, which runs on your development machine. You can invoke

    a client from a shell by issuing an adb command.

    A server, which runs as a background process on your development

    machine. The server manages communication between the client and the

    adb daemon running on an emulator or device.

    A daemon, which runs as a background process on each emulator or

    device instance.

  • 8/2/2019 Android Final 2

    46/65

    ADB COMMANDSadb push /system/app/ ----------put in system folder

    adb devices ----lists which devices are currently attached to your computer

    adb install lets you install an Android application on your phone

    adb remount Remounts your system in write mode this lets you alter system files on

    your phone using ADB

    adb push lets you upload files to your phones

    filesystem

    adb pull lets you download files off your phones

    filesystem

    adb logcat starts dumping log from the console to a local file useful for debugging apps

    adb shell drops you into a basic linux command shell on

    your phone with no parameters, or lets you run commands directly

    adb devices lists which devices are currently attached to your computer

  • 8/2/2019 Android Final 2

    47/65

    ANDROID EMULATOR

  • 8/2/2019 Android Final 2

    48/65

    EMULATOR LIMITATIONS

    No support for placing or receiving actual phonecalls

    No support for camera/video capture (input)

    No support for determining battery charge level

    Emulator limitations

    No support for Bluetooth

  • 8/2/2019 Android Final 2

    49/65

    DEBUGGING TOOLSAndroid Debug Bridge

    A versatile tool lets you manage the state of an emulatorinstance or Android-powered device.

    android

    Lets you manage AVDs, projects, and the installedcomponents of the SDK.

    dmtracedumpGenerates graphical call-stack diagrams from trace logfiles. The tool uses the Graphviz Dot utility to create thegraphical output, so you need to install Graphviz beforerunning dmtracedump. For more information on

    using dmtracedump.layoutopt

    Lets you quickly analyze your application's layouts inorder to optimize them for efficiency.

  • 8/2/2019 Android Final 2

    50/65

    DEBUGGING TOOLSlogcat

    Lets you read system log messages that are output on anAndroid device or emulator.

    mksdcard

    Helps you create a disk image that you can use with theemulator, to simulate the presence of an external storage card(such as an SD card).

    Monkey

    Runs on your emulator or device and generates pseudo-random streams of user events such as clicks, touches, orgestures, as well as a number of system-level events. You can

    use the Monkey to stress-test applications that you aredeveloping, in a random yet repeatable manner.

    sqlite3

    Lets you access the SQLite data files created and used byAndroid

    applications.

  • 8/2/2019 Android Final 2

    51/65

    COMPONENT MODELWhile each application runs as its own UNIX uid, sharing

    can occur through application-level interactions

    Interactions based on components

    Different component types :

    Activity

    Service Content Provider

    Broadcast Receiver

  • 8/2/2019 Android Final 2

    52/65

    ACTIVITY Each Activity is a screen. User actions tell an Activity to start

    another Activity, possibly with theexpectation of a result.

    The target Activity is not necessarily in

    the same application. Processing stops when another

    Activity ison top.

    However, activities can also be

    faceless One activity is designated as the entry

    point for your application Building block of an activity is View

  • 8/2/2019 Android Final 2

    53/65

    ACTIVITY LIFE CYCLE

  • 8/2/2019 Android Final 2

    54/65

    SERVICE COMPONENTBackground processing occurs in Service components.

    Downloading a file, playing music, tracking location, polling, etc.

    Local vs. Remote Services (process-level distinction)

    Also provides a service interface between applications

    Android Interface Definition Language (AIDL)

    Register callback methods

    Core functionality often implemented as Service components

    e.g., Location API, Alarm service

  • 8/2/2019 Android Final 2

    55/65

    CONTENT PROVIDER COMPONENT Content Provider components provide a standardized interfacefor sharing data, i.e., content (between applications).

    Models content in a relational DB

    Users of Content Providers can perform queries equivalent to

    SELECT, UPDATE, INSERT, DELETE

    Works well when content is tabular

    Also works as means of addressing files

  • 8/2/2019 Android Final 2

    56/65

    BROADCAST RECEIVER COMPONENT Broadcast Receiver components act as specialized event Intent

    handlers (also think of as a message mailbox).

    Broadcast Receiver components subscribeto specific action strings

    (possibly multiple)

    action strings are defined by the system or developer

    component is automatically called by the system

    Recall that Android provides automatic Activity resolution using

    action strings.

    The action string was assigned to an Intent objectSender can specify component recipient (no action string)

  • 8/2/2019 Android Final 2

    57/65

    ANDROID MANIFEST

    Manifest files are the technique for describing the contentsof an applicationpackage (i.e., resource file)

    Each Android application has a special AndroidManifest.xml

    file (included in the .apk package)

    describes the contained components

    components cannot execute unless they are listed

    specifies rules for auto-resolution

    specifies access rulesdescribes runtime dependencies

    optional runtime libraries

    required system permissions

  • 8/2/2019 Android Final 2

    58/65

    ANDROID MANIFEST

  • 8/2/2019 Android Final 2

    59/65

    EXAMPLE APPLICATIONS

  • 8/2/2019 Android Final 2

    60/65

    APK & PROJECT STRUCTURE An .apk file extension denotes

    an Android Package (APK) file.

    A variant of the JAR format, is used for thedistribution and installation of bundled

    components onto the Android mobile device

    platform.

    An APK file is an archive that usually

    contains the following folders:

    META-INF

    res

    and files:AndroidManifest.xml

    classes.dex

    resources.arsc

  • 8/2/2019 Android Final 2

    61/65

    IMPLEMENTING

    APPLICATION UI

    Java code

    Dynamic creation of UI

    e.g:

    AlertDialog.Builder alt_bld = new AlertDialog.Builder(this);

    ImageButton imgBtn = new ImageButton(this);

    LinearLayout holder = new LinearLayout(this);

    holder.addView(imgBtn);

    alt_bld.setView(holder);

    alt_bld.show()

    XMLUI creation before the creation of apk

    ANDROID UI XML

  • 8/2/2019 Android Final 2

    62/65

    ANDROID UI: XML

    ANDROID UI: VIEWS

  • 8/2/2019 Android Final 2

    63/65

    ANDROID UI: VIEWS

    An object that knows how to draw itself onthe screen

    Examples;

    android.widget.ListViewandroid.widget.DatePickerandroid.widget.Buttonandroid.widget.ImageViewandroid.view.LinearLayout

    L t

  • 8/2/2019 Android Final 2

    64/65

    Lets say

    Bye for now

    World!!

  • 8/2/2019 Android Final 2

    65/65

    The End

    ThankYou