4. The Android System



Similar documents
Android For Java Developers. Marko Gargenta Marakana

directory to "d:\myproject\android". Hereafter, I shall denote the android installed directory as

Android Introduction. Hello Mihail L. Sichitiu 1

Università Degli Studi di Parma. Distributed Systems Group. Android Development. Lecture 2 Android Platform. Marco Picone

Tutorial #1. Android Application Development Advanced Hello World App

Chapter 2 Getting Started

Hello World! Some code

Android Basics. Xin Yang

Developing Android Apps: Part 1

Mobile Application Development

Android Development. Marc Mc Loughlin

Admin. Mobile Software Development Framework: Android Activity, View/ViewGroup, External Resources. Recap: TinyOS. Recap: J2ME Framework

Android for Java Developers OSCON Marko Gargenta Marakana

Now that we have the Android SDK, Eclipse and Phones all ready to go we can jump into actual Android development.

Building an Android client. Rohit Nayak Talentica Software

MMI 2: Mobile Human- Computer Interaction Android

Lecture 1 Introduction to Android

Android Services. Services

Mobile Application Frameworks and Services

Android 多 核 心 嵌 入 式 多 媒 體 系 統 設 計 與 實 作

Android Concepts and Programming TUTORIAL 1

Introduction to Android SDK Jordi Linares

Android Application Development: Hands- On. Dr. Jogesh K. Muppala

CSE476 Mobile Application Development. Yard. Doç. Dr. Tacha Serif Department of Computer Engineering Yeditepe University

How to develop your own app

Getting Started: Creating a Simple App

Android Programming Basics

ECWM511 MOBILE APPLICATION DEVELOPMENT Lecture 1: Introduction to Android

Android Persistency: Files

Android Development Introduction CS314

Programming with Android: System Architecture. Dipartimento di Scienze dell Informazione Università di Bologna

ANDROID APPS DEVELOPMENT FOR MOBILE AND TABLET DEVICE (LEVEL I)

Google s Android: An Overview

Running a Program on an AVD

By sending messages into a queue, we can time these messages to exit the cue and call specific functions.

Presenting Android Development in the CS Curriculum

Frameworks & Android. Programmeertechnieken, Tim Cocx

An Introduction to Android Application Development. Serdar Akın, Haluk Tüfekçi

TUTORIALS AND QUIZ ANDROID APPLICATION SANDEEP REDDY PAKKER. B. Tech in Aurora's Engineering College, 2013 A REPORT

Introduction to Android. Sean Sullivan October 27, 2008

How To Develop Android On Your Computer Or Tablet Or Phone

BEGIN ANDROID JOURNEY IN HOURS

Basics. Bruce Crawford Global Solutions Manager

Table of Contents. Adding Build Targets to the SDK 8 The Android Developer Tools (ADT) Plug-in for Eclipse 9

Hacking your Droid ADITYA GUPTA

Mocean Android SDK Developer Guide

Mobility Introduction Android. Duration 16 Working days Start Date 1 st Oct 2013

Android Environment SDK

Android Java Live and In Action

Android Geek Night. Application framework

Specialized Android APP Development Program with Java (SAADPJ) Duration 2 months

Intro to Android Development 2. Accessibility Capstone Nov 23, 2010

INTRODUCTION TO ANDROID CSCI 4448/5448: OBJECT-ORIENTED ANALYSIS & DESIGN LECTURE 11 02/15/2011

TomTom PRO 82xx PRO.connect developer guide

App Development for Smart Devices. Lec #4: Services and Broadcast Receivers Try It Out

Mobile Application Development Android

App Development for Android. Prabhaker Matet

MAP524/DPS924 MOBILE APP DEVELOPMENT (ANDROID) MIDTERM TEST OCTOBER 2013 STUDENT NAME STUDENT NUMBER

Login with Amazon Getting Started Guide for Android. Version 2.0

Introduction to Android. CSG250 Wireless Networks Fall, 2008

Deep Inside Android. OpenExpo Zurich September 25 th, Gilles Printemps - Senior Architect. Copyright 2007 Esmertec AG.

IOIO for Android Beginners Guide Introduction

Developing NFC Applications on the Android Platform. The Definitive Resource

ANDROID PROGRAMMING - INTRODUCTION. Roberto Beraldi

ITG Software Engineering

06 Team Project: Android Development Crash Course; Project Introduction

Android Environment SDK

UNIVERSITY AUTHORISED EDUCATION PARTNER (WDP)

System Structures. Services Interface Structure

Android Programming and Security

CS 696 Mobile Phone Application Development Fall Semester, 2009 Doc 9 Location & Maps Sept 29, 2009

Module Title: Software Development A: Mobile Application Development

Getting started with Android and App Engine

TUTORIAL. BUILDING A SIMPLE MAPPING APPLICATION

Introduction to NaviGenie SDK Client API for Android

An Android-based Instant Message Application

ANDROID INTRODUCTION TO ANDROID

Based on Android 4.0. by Lars Vogel. Version 9.8. Copyright 2009, 2010, 2011, 2012 Lars Vogel Home Tutorials Trainings Books Social

Android App Development. Rameel Sethi

Advantages. manage port forwarding, set breakpoints, and view thread and process information directly

Android. Learning Android Marko Gargenta. Tuesday, March 11, 14

Building Your First App

Overview. The Android operating system is like a cake consisting of various layers.

Tutorial: Setup for Android Development

ECWM511 MOBILE APPLICATION DEVELOPMENT Lecture 1: Introduction to Android

1. Introduction to Android

Gauthier Picard. Ecole Nationale Supérieure des Mines

Graduate presentation for CSCI By Janakiram Vantipalli ( Janakiram.vantipalli@colorado.edu )

Introduction to Android: Hello, Android! 26 Mar 2010 CMPT166 Dr. Sean Ho Trinity Western University

Android Development. Lecture AD 0 Android SDK & Development Environment. Università degli Studi di Parma. Mobile Application Development

Software Environments of Smartphone Applications

Android Apps Development Boot Camp. Ming Chow Lecturer, Tufts University DAC 2011 Monday, June 6, 2011

CSCI E 98: Managed Environments for the Execution of Programs

ODROID Multithreading in Android

Developer's Cookbook. Building Applications with. The Android. the Android SDK. A Addison-Wesley. James Steele Nelson To

Lab 4 In class Hands-on Android Debugging Tutorial

Android Application Development - Exam Sample

Getting Started With Android

Android Development Tutorial

Transcription:

4. The Android System 4. The Android System System-on-Chip Emulator Overview of the Android System Stack Anatomy of an Android Application 73 / 303

4. The Android System Help Yourself Android Java Development Kit Programming Android applications: http://code.google.com/android/documentation.html Training: http://developer.android.com/training/index.html Tools: http://code.google.com/android/intro/tools.html API: http://code.google.com/android/reference Emulator: http://code.google.com/android/reference/emulator.html Tutorial: http://code.google.com/android/intro/tutorial.html Design: http://code.google.com/android/devel Android is just a very good example and a valuable open platform to explore the design and implementation of a mobile device 74 / 303

4. The Android System System-on-Chip Emulator 4. The Android System System-on-Chip Emulator Overview of the Android System Stack Anatomy of an Android Application 75 / 303

4. The Android System System-on-Chip Emulator Full-System Emulation QEMU Emulation of the guest system (e.g., mobile phone)...... on a host system (e.g., your laptop) Starting the emulator: $ emulator ($ emulator -help for list of options) More information on the baseline emulator: www.qemu.org 76 / 303

4. The Android System System-on-Chip Emulator Full-System Emulation Goldfish SoC Good representative of a simple system-on-chip ARM11 microprocessor (ARMv5 machine language) Video: framebuffer Audio in and out Missing (currently) in the emulated SoC: GSM/UMTS, bluetooth, Wifi, camera, GPS, accelerometer GSM and GPS can be forwarded to a host device $ emulator -radio device -gps device Demonstration Kernel boot log $ emulator @inf422 -show-kernel 77 / 303

4. The Android System System-on-Chip Emulator Interaction With the Emulator Android Debug Bridge Run from a command line of the host system $ adb options commands Copy to/from android $ adb push host android / $ adb pull android host Forward network connections from the host to android (and other options) $ adb forward tcp:host port tcp:device port 78 / 303

4. The Android System Overview of the Android System Stack 4. The Android System System-on-Chip Emulator Overview of the Android System Stack Anatomy of an Android Application 79 / 303

4. The Android System Overview of the Android System Stack Android System Stack 80 / 303

4. The Android System Overview of the Android System Stack Java Virtual Machine Bytecode (.class/.jar/.dex/.apk) Class loader and verifier Program Interpreter bytecode & native JIT compiler Stack Heap Static Garbage Collector All Android applications run on top of the Dalvik JVM A Java method can be interpreted directly or optimized and compiled to native (machine) code Delayed compilation to a specific target machine language is called Just-In-Time (JIT) compilation Android has JIT compiler since version 2.2 Operating system processes and threads 81 / 303

4. The Android System System-on-Chip Emulator Overview of the Android System Stack Anatomy of an Android Application 82 / 303

Activity Activity: Interactive Task Stack of running activities Events associated with creation, destruction, access to the framebuffer (screen) and user-interface Starts with one main thread in charge of user interactions 83 / 303

Activity Skeleton of an Activity package com.android.myactivity; import android.app.activity; import android.os.bundle; public class MyActivity extends Activity { // Method called when (an instance of) the Activity is created public void oncreate(bundle savedinstancestate) { // Delegate the generic work to the parent Activity class super.oncreate(savedinstancestate); // Display the XML layout in the screan associated with the Activity setcontentview(r.layout.main); } } // More work, typically run in a concurrent thread 84 / 303

Activity 85 / 303

Service Service: Non-Interactive Task Default system services Activities may launch services Services may have interactions through Notification widgets and events 86 / 303

Service Skeleton of a Service package com.android.myservice; import android.app.service; public class MyService extends Service { // Method called when (an instance of) the Service is created public void oncreate() { // Start up the thread running the Service // Create a separate thread because to avoid blocking the Service main thread Thread st = new Thread() { void run() { /*... */ } }; st.start(); } } // Method called when the (instance of) the Service is requested to terminate public void ondestroy() { /*... */ } 87 / 303

Service 88 / 303

Manifest File Example: Simple Activity With Internet Access Permission <?xml version="1.0" encoding="utf-8"?> <manifest xmlns:android="http://schemas.android.com/apk/res/android" package="com.android.td3"> <application android:icon="@drawable/icon" android:label="@string/app name"> <activity android:name=".td3" android:label="@string/app name"> <intent-filter> <action android:name="android.intent.action.main"/> <category android:name="android.intent.category.launcher"/> </intent-filter> </activity> </application> <uses-permission xmlns:android="http://schemas.android.com/apk/res/android" android:name="android.permission.internet"></uses-permission> </manifest> 89 / 303

Resources and Intents Resource External value or name-value pair defined in the Android project tree res directory of a project tree Intent Binding between a class and an activity in charge of it, e.g., Displaying a given media format Associating an interactive notification to a particular event 90 / 303

Graphical User Interface (GUI) High-Level XML Layout Organized into Layouts and Views (GUI widgets) res/layout/main.xml (generated from interactive editor) R class automatically generated (unique identifier for each View in the GUI) Example <?xml version="1.0" encoding="utf-8"?> <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" android:layout width="fill parent" android:layout height="fill parent" android:orientation="vertical" android:gravity="top"> <EditText android:id="@+id/txtmem" android:editable="false" android:cursorvisible="false" android:layout width="fill parent" android:layout height="wrap content"/> <Button android:id="@+id/save button" android:layout width="wrap content" android:layout height="wrap content" android:text="save"/> </LinearLayout> 91 / 303

Graphical User Interface (GUI) Interacting With the GUI Important: only the main thread can directly call View methods Design choice: reduce the number of concurrent threads, makes View methods simpler and faster (no implicit synchronization) Use a call-back mechanism for other threads to command the execution of a View method in the main thread 92 / 303

Graphical User Interface (GUI) Explicit Call-Back Example Call-back handler: command queue Attached to the thread it was created from, by default Each command is defined by an object of type Runnable Handler callback = new Handler(); Runnable update_meminfo = new Runnable() { public void run() { EditText txt_meminfo; txt_meminfo = (EditText)findViewById(R.id.txtmem); txt_meminfo.settext("memoire libre (kb): " + /*... */); } }; /*... */ // In the run() method of another thread void run() { /*... */ callback.post(update_meminfo); } 93 / 303

Graphical User Interface (GUI) Implicit Call-Back Example Event-driven execution in the GUI s event loop, similar to a call-back A custom command is defined by overloading the onclick() method View.OnClickListener save_to_log = new OnClickListener() { public void onclick(view v) { EditText txt_meminfo; txt_meminfo = (EditText)findViewById(R.id.txtmem); txt_meminfo.settext("memoire libre (kb): " + /*... */); } }; /*... */ // In the oncreate() method of the Activity Button button = (Button)findViewById(R.id.save_button); button.setonclicklistener(save_to_log); 94 / 303