Programming with Android: System Architecture

Slides:



Advertisements
Similar presentations
Android Application Development A Tutorial Driven Course.
Advertisements

Google Android Introduction to Mobile Computing. Android is part of the build a better phone process Open Handset Alliance produces Android Comprises.
Programming with Android: SDK install and initial setup Luca Bedogni Marco Di Felice Dipartimento di Scienze dellInformazione Università di Bologna.
Programming with Android: System Architecture
What is Android?.
Android architecture overview
Introduction to Android Mohammad A. Gowayyed CS334-Spring 2014.
Android Platform Overview (1)
DEPARTMENT OF COMPUTER ENGINEERING
ANDROID OPERATING SYSTEM Guided By,Presented By, Ajay B.N Somashekar B.T Asst Professor MTech 2 nd Sem (CE)Dept of CS & E.
1 CSCE 4013: Mobile Systems Programming Nilanjan Banerjee Mobile Systems Programming University of Arkansas Fayetteville, AR
Mobile Application Development
Programming with Android: System Architecture
@2011 Mihail L. Sichitiu1 Android Introduction Platform Overview.
Asst.Prof.Dr.Ahmet Ünveren SPRING Computer Engineering Department Asst.Prof.Dr.Ahmet Ünveren SPRING Computer Engineering Department.
Introduction to Android Platform Overview
Getting Started with Android Development Rohit Ghatol.
Emerging Platform#4: Android Bina Ramamurthy.  Android is an Operating system.  Android is an emerging platform for mobile devices.  Initially developed.
Android Middleware Bo Pang
Android Introduction Platform Overview.
Mobile Application Development with ANDROID Tejas Lagvankar UMBC 29 April 2009.
Mobile Application Development with ANDROID. Agenda Mobile Application Development (MAD) Intro to Android platform Platform architecture Application building.
About me Yichuan Wang Android Basics Credit goes to Google and UMBC.
Mobile Application Development using Android
@2011 Mihail L. Sichitiu1 Android Introduction Platform Overview.
Copyright© Jeffrey Jongko, Ateneo de Manila University Android.
01. Introduction to Android Prof. Oum Saokosal Master of Engineering in Information Systems, South Korea
Presentation Seminar on “IMAGE SLIDER –AN ANDROID APPLICATION”
ANDROID Presented By Mastan Vali.SK. © artesis 2008 | 2 1. Introduction 2. Platform 3. Software development 4. Advantages Main topics.
Android for Java Developers Denver Java Users Group Jan 11, Mike
ANDROID OS Architecture
ANDROID 응용 프로그래밍 과정 – 목차 - 안드로이드란 - 안드로이드가 만들어지게 된배경 - 안드로이드의 철학 - 안드로이드 환경설정 ( SDK download, eclipse plug-in 설정, 간단한 프로그램 실행 ) - 안드로이드 동작원리 - 안드로이드 핵심.
Overview of Android Application Development
ANDROID L. Grewe Components  Java Standard Development Kit (JDK) (download) (latest version)  AndroidStudio.
ANDROID BY:-AANCHAL MEHTA MNW-880-2K11. Introduction to Android Open software platform for mobile development A complete stack – OS, Middleware, Applications.
Created By. Jainik B Patel Prashant A Goswami Gujarat Vidyapith Computer Department Ahmedabad.
1 Android Introduction Platform Overview. 2 What is Android?  Android is a software stack for mobile devices that includes an operating system, middleware.
Mobile Application Development with ANDROID Umang Patel(6537) LDCE.
By, Rutika R. Channawar. Content Introduction Open Handset Alliance Minimum Hardware Requirements Versions Feature Architecture Advantages Disadvantages.
1 Android Workshop Platform Overview. 2 What is Android?  Android is a software stack for mobile devices that includes an operating system, middleware.
Mobile Software Development for Android - I397 IT COLLEGE, ANDRES KÄVER, WEB:
Android Development For Beginners. What is Android? Android is an open mobile phone platform that was developed by Google and later by Open Handset Alliance.
Android operating system N. Sravani M. Tech(CSE) (09251D5804)
By : Abhishek Verma Main Topics : 1. Introduction 2. Platform 3. Software Development 4. Overall Evaluation.
By Adam Reimel. Outline Introduction Platform Architecture Future Conclusion.
Android. I. What’s Android Android is a mobile operating system (OS) based on the Linux kernel and currently developed by Google. Android is designed.
ANDROID OS Ravi Soni MTech (CS) III Sem. W HAT IS A NDROID ? Android is a software stack for mobile devices that includes an operating system, middleware.
The Ingredients of Android Applications. A simple application in a process In a classical programming environment, the OS would load the program code.
CMPE419 Mobile Application Development Asst.Prof.Dr.Ahmet Ünveren SPRING Computer Engineering Department Asst.Prof.Dr.Ahmet Ünveren
Android. Android An Open Handset Alliance Project A software platform and operating system for mobile devices Based on the Linux kernel Developed by Google.
The Basics of Android App Development Sankarshan Mridha Satadal Sengupta.
A presentation on Android and Android project Around Me
Android Mobile Application Development
Android Application -Architecture.
Visit for more Learning Resources
ANDROID AN OPEN HANDSET ALLIANCE PROJECT
Android Runtime – Dalvik VM
Android.
Software Engineering in Mobile Computing
Contents: Introduction Different Mobile Operating Systems
Android: System Architecture
ANDROID OS Architecture
CMPE419 Mobile Application Development
Application Development A Tutorial Driven Course
Android Developer Fundamentals V2
Android Introduction Platform Mihail L. Sichitiu.
Android Platform, Android App Basic Components
Emerging Platform#3 Android & Programming an App
Introduction to Android
CMPE419 Mobile Application Development
Presentation transcript:

Programming with Android: System Architecture Luca Bedogni Marco Di Felice Dipartimento di Scienze dell’Informazione Università di Bologna

Outline Android Architecture: An Overview Android Dalvik Java Virtual Machine Android Components: Activities Android Components: Intents Android Components: Services Android Components: Content Providers Android Application Distribution and Markets 2

? Android … What? Which kind of mobile devices … (examples) Android is a Linux-based platform for mobile devices … Operating System Middleware Applications Software Development Kit (SDK) Which kind of mobile devices … (examples) ? SMARTPHONES TABLETS EREADERS ANDROID TV GOOGLE GLASSES 3

? Android … What? ANDROID MICROWAVE SMART FRIDGE 4 SMARTPHONES TABLETS EREADERS ANDROID TV GOOGLE GLASSES 4

Android … When? Google buys Android from the Android Inch 2005 Google buys Android from the Android Inch Open Handset Alliance (OHA) created for open standards for mobile devices. Partners of OHA: Google, Motorola, Samsung, Vodafone, T-Mobile, etc Android 1.0 Released The first Android smartphone: G1 HTC-Dream Android 1.1 Released Android 1.5 (CupCake) Released 2006 2007 2008 2009 Time 5

Android … When? Android 1.6 (Donut) Released Android 2.0 (Eclair) Released Android 2.2 (Froyo) Released Android 2.3 (Gingerbread) Released Android 3.0 (Honeycomb) Released (First version for devices with larger screens such as tablets) Android 4.0 (Ice-Cream Sandwich) Released. (It merges the 3.x tab centric design and the v2.x phone based design into a single version.) 2008 2009 2010 2011 2012 Time 6

Android … When? Android 4.4 (Kitkat) Released Wireless printing capability Ability for applications to use "immersive mode” Performance optimization New experimental runtime virtual machine, ART… API Level 19 (Android 4.4): Support to new embedded sensors (e.g. STEP_DETECTOR) Adaptive video playback functionalities Read and write SMS and MMS messages (managing default text messaging client) 2012 2013 2014 ANDROID 5.0 Time 7

Android … When? 2012 Market Share www.gartner.com 2013 Market Share 8

Android … When? 11,868 different devices in 2013! http://opensignal.com/reports/fragmentation-2013/ 9

Android … When? Updated at February 2014 10 http://developer.android.com/about/dashboards/index.html Updated at February 2014 10

HISTORY AND POPULARITY Android … When? http://en.wikipedia.org/wiki/Android_version_history 1.6-2.0 2.2.x 2.3.x ANDROID VERSION HISTORY AND POPULARITY (2009-2013) 4.x 11

Android … When? ANDROID APP CATEGORIES ANDROID APP PRICE 12 http://www.appbrain.com/stats/android-market-app-categories http://www.onlinemarketing-trends.com/2011/07/android-marketplace-top-5-statistics.html 12

The Android Architecture } Stack Architecture Open Source Architecture (Apache/MIT License v. 2.0) Business-friendly License 13

The Android Architecture Built on top of Linux kernel (v. 2.6-3.4) Advantages: Portability (i.e. easy to compile on different hardware architectures) Security (e.g. secure multi-process environment) Power Management 14

The Android Architecture Native Libraries (C/C++ code) Graphics (Surface Manager) Multimedia (Media Framework) Database DBMS (SQLite) Font Management (FreeType) WebKit C libraries (Bionic) …. 15

The Android Architecture Application Libraries (Core Components of Android) Activity Manager Packet Manager Telephony Manager Location Manager Contents Provider Notification Manager …. 16

The Android Architecture Applications (Written in Java code) Android Play Store Entertainment Productivity Personalization Education Geo-communication …. 17

The Android Architecture Dalvik Virtual Machine (VM) Novel Java Virtual Machine implementation (not using the Oracle JVM) Open License (Oracle JVM is not open!) Optimized for memory-constrained devices Faster than Oracle JVM …. 18

Dalvik Java Virtual Machine (JVM) Java Source Code Java Source Code Java Standard Edition Java Compiler Java Compiler Java Byte Code Java Byte Code Dex Compiler Stack-based byte-code Dalvik Byte Code Register-based byte-code Java Virtual Machine (JVM) Dalvik Virtual Machine (VM) 19

Android Applications Design APPLICATION DESIGN: GUI Definition Events Management Application Data Management Background Operations User Notifications 20

Android Applications Design APPLICATION COMPONENTS Activities & Fragments Intents Services Content Providers Broadcast Receivers 21

Android Components: Activities An Activity corresponds to a single screen of the Application. An Application can be composed of multiples screens (Activities). The Home Activity is shown when the user launches an application. Different activities can exhange information one with each other. Hello World! Android HelloWorld Button1 22

Android Components: Activities Each activity is composed by a list of graphics components. Some of these components (also called Views) can interact with the user by handling events (e.g. Buttons). Two ways to build the graphic interface: PROGRAMMATIC APPROACH Example: Button button=new Button (this); TextView text= new TextView(); text.setText(“Hello world”); 23

Android Components: Activities Each activity is composed by a list of graphics components. Some of these components (also called Views) can interact with the user by handling events (e.g. Buttons). Two ways to build the graphic interface: DECLARATIVE APPROACH Example: < TextView android.text=@string/hello” android:textcolor=@color/blue android:layout_width=“fill_parent” android:layout_height=“wrap_content” /> < Button android.id=“@+id/Button01” android:textcolor=“@color/blue” android:layout_width=“fill_parent” android:layout_height=“wrap_content” /> 24

Android Components: Activities EXAMPLE Build the application layout through XML files (like HTML) Define two different XML layouts for two different devices At runtime, Android detects the current device configuration and loads the appropriate resources for the application No need to recompile! Just add a new XML file if you need to support a new device Device 1 HIGH screen pixel density Device 2 LOW screen pixel density Java App Code XML Layout File Device 1 XML Layout File Device 2 25

Android Components: Activities EXAMPLE SCREEN CONFIGURATION DISTRIBUTION Device 1 HIGH screen pixel density Device 2 LOW screen pixel density Java App Code XML Layout File Device 1 XML Layout File Device 2 http://developer.android.com/about/dashboards/index.html 26

Android Components: Activities Android applications typically use both the approaches! DECLARATIVE APPROACH Define the Application layouts and resources used by the Application (e.g. labels). XML Code PROGRAMMATIC APPROACH Manages the events, and handles the interaction with the user. Java Code 27

Android Components: Activities Views can generate events (caused by human interactions) that must be managed by the Android-developer. Button TextEdit ESEMPIO public void onClick(View arg0) { if (arg0 == Button) { // Manage Button events } 28

Android Components: Activities The Activity Manager is responsible for creating, destroying, managing activities. Activities can be on different states: starting, running, stopped, destroyed, paused. Only one activity can be on the running state at a time. Activities are organized on a stack, and have an event-driven life cycle (details later …) 29

Android Components: Activities Main difference between Android-programming and Java (Oracle) -programming: Mobile devices have constrained resource capabilities! Activity lifetime depends on users’ choice (i.e. change of visibility) as well as on system contraints (i.e. memory shortage). Developer must implement lifecycle methods to account for state changes of each Activity … 30

Android Components: Activities public class MyApp extends Activity { public void onCreate() { ... } public void onPause() { ... } public void onStop() { ... } public void onDestroy(){ ... } …. } Called when the Activity is created the first time. Called when the Activity is partially visible. Called when the Activity is no longer visible. Called when the Activity is dismissed. 31

Android Components: Intents Intents: asynchronous messages to activate core Android components (e.g. Activities). Explicit Intent  The component (e.g. Activity1) specifies the destination of the intent (e.g. Activity 2). LOGIN Welcome Marco! marco Activity1 PASSWORD Activity2 ********** Login Intent Login 32

Android Components: Intents Intents: asynchronous messages to activate core Android components (e.g. Activities). Implicit Intent  The component (e.g. Activity1) specifies the type of the intent (e.g. “View a video”). Activity2 Multiple choices might be available to the user! } Intent- Filters Activity1 View Implicit Intent Activity2 33

Android Components: Services Services: like Activities, but run in background and do not provide an user interface. Used for non-interactive tasks (e.g. networking). Service life-time composed of 3 states: Starting Destroyed onCreate() onStart() onDestroy() Running (on background) 34

Android Components: Content Providers Each Android application has its own private set of data (managed through files or through SQLite database). Content Providers: Standard interface to access and share data among different applications. insert() APP update() DB Content Provider delete() query() e.g. Photo Gallery 35

Android Components: Broadcast Receivers Publish/Subscribe paradigm Broadcast Receivers: An application can be signaled of external events. Notification types: Call incoming, SMS delivery, Wifi network detected, etc 36

Android Components: Broadcast Receivers BROADCAST RECEIVER example class WifiReceiver extends BroadcastReceiver { public void onReceive(Context c, Intent intent) { String s = new StringBuilder(); wifiList = mainWifi.getScanResults(); for(int i = 0; i < wifiList.size(); i++){ s.append(new Integer(i+1).toString() + "."); s.append((wifiList.get(i)).toString()); s.append("\\n"); } mainText.setText(sb); } } 37

Android Components: System API Using the components described so far, Android applications can then leverage the system API … Telephony Manager data access (call, SMS, etc) Sensor management (GPS, accelerometer, etc) Network connectivity (Wifi, bluetooth, NFC, etc) Web surfing (HTTP client, WebView, etc) Storage management (files, SQLite db, etc) …. SOME EXAMPLEs … 38

Android Components: Google API … or easily interface with other Google services: 39

Android Application Distribution Each Android application is contained on a single APK file. Java Byte-code (compiled for Dalvik JVM) Resources (e.g. images. videos, XML layout files) Libraries (optimal native C/C++ code) APK FILE C XML Files 40

Android Application Distribution Each application must be signed through a key before being distributed. Applications can be distributed via Web or via Stores. Android Play Store: application store run by Google … but several other application stores are available (they are just normal applications). 41

Android Application Security Android applications run with a distinct system identity (Linux user ID and group ID), in an isolated way. Applications must explicitly share resources and data. They do this by declaring the permissions they need for additional capabilities. Applications statically declare the permissions they require. User must give his/her consensus during the installation. ANDROIDMANIFEST.XML <uses-permission android:name=“android.permission.IACCESS_FINE_LOCATION" /> <uses-permission android:name=“android.permission.INTERNET" /> 42