A Short Introduction to Android

Similar documents
Android Fundamentals 1

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

Overview of CS 282 & Android

ANDROID PROGRAMMING - INTRODUCTION. Roberto Beraldi

Технологии Java. Android: Введение. Кузнецов Андрей Николаевич. Санкт-Петербургский Государственный Политехнический Университет

The Android Platform

Android Basics. Xin Yang

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

ECWM511 MOBILE APPLICATION DEVELOPMENT Lecture 1: Introduction to Android

Android Architecture. Alexandra Harrison & Jake Saxton

Lecture 1 Introduction to Android

ITG Software Engineering

ANDROID PROGRAMMING - INTRODUCTION. Roberto Beraldi

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

INTERMEDIATE ANDROID DEVELOPMENT Course Syllabus

Android Application Development. Daniel Switkin Senior Software Engineer, Google Inc.

Here to take you beyond Mobile Application development using Android Course details

Programming the Android Platform. Logistics

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

Introduction to Android

Introduction to Android. CSG250 Wireless Networks Fall, 2008

Creating and Using Databases for Android Applications

ANDROID INTRODUCTION TO ANDROID

Android (Basic + Advance) Application Development

Workshop on Android and Applications Development

ANDROID BASED MOBILE APPLICATION DEVELOPMENT and its SECURITY

Android Operating System

GETTING STARTED WITH ANDROID DEVELOPMENT FOR EMBEDDED SYSTEMS

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

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

An Introduction to Android

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

Getting Started with Android Programming (5 days) with Android 4.3 Jelly Bean

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

Android for Java Developers OSCON Marko Gargenta Marakana

Des Moines Area Community College

Android Developer Fundamental 1

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

Reminders. Lab opens from today. Many students want to use the extra I/O pins on

ECWM511 MOBILE APPLICATION DEVELOPMENT Lecture 1: Introduction to Android

ANDROID OPERATING SYSTEM

Android Operating System:

Mobile Applications Grzegorz Budzyń Lecture. 2: Android Applications

Android Application Development

Praktikum Entwicklung Mediensysteme (für Master)

Android Geek Night. Application framework

Praktikum Entwicklung von Mediensystemen (Android)

Introduction to Android

COURSE CONTENT. GETTING STARTED Select Android Version Create RUN Configuration Create Your First Android Activity List of basic sample programs

Android Development. Marc Mc Loughlin

CHAPTER 1: INTRODUCTION TO ANDROID, MOBILE DEVICES, AND THE MARKETPLACE

Android in Action. Second Edition. Revised Edition of Unlocking Android MANNING. (74 w. long.) W. FRANK ABLESON CHRIS KING ROBI SEN.

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

Android Application Development

A Look through the Android Stack

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

Google s Android: An Overview

Issues in Android on Mobile Platform and Their Resolution

Introduction to Android Programming (CS5248 Fall 2015)

Hacking your Droid ADITYA GUPTA

Android Mobile App Building Tutorial

Google Android Syllabus

Android Application Model

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

Lecture 12 Working with Location Sensors and Review

Università Degli Studi di Parma. Distributed Systems Group. Android Development. Lecture 1 Android SDK & Development Environment. Marco Picone

4 Application Development

Android Application Development - Exam Sample

Basics of Android Development 1

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

Disclaimer: The contents in this document are only my personal opinions, do not reflect the opinions of my employer or anyone else.

l What is Android? l Getting Started l The Emulator l Hello World l ADB l Text to Speech l Other APIs (camera, bitmap, etc)

Mobile Application Development 2014

Building an Android client. Rohit Nayak Talentica Software

Hello World! Some code

Programming with Android

Frameworks & Android. Programmeertechnieken, Tim Cocx

1. Introduction to Android

Introduction to Android Development. Jeff Avery CS349, Mar 2013

App Development for Smart Devices. Lec #2: Android Tools, Building Applications, and Activities

ANDROID. Programming basics

Jordan Jozwiak November 13, 2011

Lecture 17: Mobile Computing Platforms: Android. Mythili Vutukuru CS 653 Spring 2014 March 24, Monday

Mobile Phones Operating Systems

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

Mobile Security - Tutorial 1. Beginning Advanced Android Development Brian Ricks Fall 2014

Synthesis for Developing Apps on Mobile Platforms

Frequently Asked Questions: Cisco Jabber 9.x for Android

Example of Standard API

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

Android 5.0: Lollipop OS

ODROID Multithreading in Android

Mobile App Design and Development

Developing NFC Applications on the Android Platform. The Definitive Resource

workforceiq Job Despatch and Workforce Management software for Smartphones

Android Architecture Diagram:

Q1. What method you should override to use Android menu system?

Development. SriSeshaa Technologies. Table of Contents

Beginner s Android Development Tutorial!

Android Application for Vehicle Theft Prevention and Tracking System

Transcription:

A Short Introduction to Android Notes taken from Google s Android SDK and Google s Android Application Fundamentals 1

Plan For Today Lecture on Core Android Three U-Tube Videos: - Architecture Overview http://www.youtube.com/watch?v=mm6ju0xhuw8 - Application Lifecycle http://www.youtube.com/watch?v=fl6gsd4ugsi - Application Programmer Interfaces http://www.youtube.com/watch?v=mpukbh6d-ly 2

Why Android? Mobile platforms represent important components of distributed systems. Android is a new and interesting mobile platform. Android may also become important on non-mobile platforms. We will look at Android from a developers 95-702 Distributed point Systems of view. 3

What is Android? Applications Contacts Phone Browser Home Application Framework Window Manager Content Providers Location Manager Activity Manager Libraries SQLite SSL WebKit Android Runtime VM Linux Kernel WiFi Driver Binder (IPC) driver Camera Driver 4

System Architecture Diagram from Google 5

Linux Provides Hardware abstraction drivers Memory management Process Security Model Networking 6

Native Libraries Sit on top of Linux Written in C/C++ Drawing, Graphics (3D and 2D) Media framework (codecs like MP4 to code and decode MP4 bit streams) Font rendering Database (SQLLite) WebKit Android runtime (VM) mutiple instances 7

Application Framework in Java (1) Activity Manager Package Manager Windows Manager Telephony Manager Content Providers Resource Manager View System Location Manager Notification Manager XMPP Service This is a toolkit for applications. Applications are such things as the phone application and the contacts application. 8

Application Framework in Activity Manager Java (2) Manages the lifecycle of applications. Applications cycle through various states: Started, Running, Background, Killed. Maintains a common stack allowing the user to navigate from one application to another. 9

Application Framework in Package Manager Java (3) Maintains information on the available applications on the device. 10

Application Framework in Windows Manager Java (4) Performs window management. 11

Application Framework in Java (5) Telephony Manager API s needed to build the phone application and SMS. 12

Application Framework in Java (6) Content Provider Allows one application to make its data available to another. For example, the contacts application makes its data available to other applications that may need it. The phone or email application may need to consult contacts. 13

Application Framework in Java (7) Resource Manager Manages the storing of strings and layout files and bitmaps. Android will run on many devices in many regions. To reach the most users, your application should handle text, audio files, numbers, currency, and graphics in ways appropriate to the locales where your application 95-702 Distributed will be Systems used. (From the SDK) 14

Application Framework in Java (8) View System Contains the building blocks of the user interface buttons, text boxes and so on. Handles event dispatching, layouts and drawing. The View class is the base class for the Widget class. All views in a window are organized in a single tree. 15

Application Framework in Java (9) Location Manager - Uses GPS most accurate, slow, battery drain, and primarily for outdoor use. - Uses the Android Network provider which uses cell tower and wi-fi signals. 16

Application Framework in Java (10) Notification Manager Alerts the user about events. Status bar updates, flashing lights, vibrations and the like. 17

Application Framework in Java (11) XMPP Service IETF Standard: The Extensible Messaging and Presence Protocol ( Presence = who s online?) XML Based Internet Instant Messaging Adopted by GoogleTalk (Voice over IP and Instant Messaging) Provides for offline messaging. Unsure if still supported by Android. 18

Example(1): Using The Telephony Manager import android.telephony.telephonymanager; Your application requests READ_PHONE_STATE permissions. Ask the system for a pointer to the TelephonyManager. Register a listener for state changes. Make calls on the TelephonyManager class. The android.telephony.gsm package allows your application to send and receive SMS or MMS messages. 19

Example (2): Using The Location Manager Ask system for a pointer to the LocationManager. Permissions requested in the manifest. Implement a location listener. Receive a GeoCoder object. A GeoCoder provides geocoding and reverse geocoding. Geocoding is the process of transforming a street address or other description of a location into a (latitude, longitude) coordinate. Reverse geocoding is the process of transforming a (latitude, longitude) 95-702 Distributed coordinate Systems into a (partial) address. 20

Example (3): Maps in Two Ways (1) Create an Intent with an Action_View and a URI holding longitude and latitude. Call startactivity with the Intent. (2) For greater control, add a MapView widget to your application. 21

Application Fundamentals An Android package (.apk file) holds an application. No single entry point. The system can instantiate and run components as needed. There are four types of components found within an application. 22

Android s Component Model An application will be built from: Activity Components Service Components Intent Receiver Components Content Provider Components 23

Activity Components Activity A concrete class that may be subclassed. Often represents a single full screen window. One focused endeavor. Has a well-defined life-cycle: oncreate() onstart() onresume() onfreeze() onstop() ondestroy() 24

Activity Components Activity One activity may start another within the same application. An application would usually consist of several activities. Activity Activity Each activity usually represents a single screen. The user s interaction takes place through views. Views consist of buttons, text fields, scroll bars, etc., and are organized in a hierarchy. 25

Service Components Service Service A service has no visual user interface. It runs in the background for some indefinite period of time. A service may expose an interface. Using a service component, we can expose functionality to other applications. Services may be started by an Activity and may continue after the Activity leaves the screen. 26

Intent or Broadcast Receiver Components Activity Component Intent or Broadcast Receiver Component Service Component May be used to start an activity when a message arrives. The Intent receiver component does nothing but react to announcements. Many announcements originate in system code for example, announcements that the time zone has changed or that the battery is low. Applications can also initiate announcements to let other applications know of some change in state. (From http://developer.android.com/ Reference/android/content/ContentProvider.html) 27

Content Provider Component Activity Intent Receiver Service Content Provider A content provider makes a specific set of the application's data available to other applications. If you don't need to share data amongst multiple applications you can use a database directly via SQLiteDatabase. (From http://developer.android.com/ Reference/android/content/ContentProvider.html) 28

Activity Service Messaging Intent Receiver Content Provider When a request should be handled by a particular component, Android will start the application and make sure the component instance is available. UI Events Looper Message Queue System Events 29

A Linux Process Activity Broadcast Receiver Service Content Provider Looper Message Queue Each process is started with a generated unique user-id. Linux is built to protect users from each other. The user-id provides an application sandbox. 30

Inter-Process Communication Two approaches: (1) Intents (2) Remote Methods Process A Process B 31

Inter-Process Communication - Intents From Google s Developer s Reference: An intent is an abstract description of an operation to be performed Suppose, for example, that my application wants to make a phone call: Intent callintent = new Intent(Intent.ACTION_CALL); callintent.setdata(uri.parse( tel:4122684657 ); startactivity(callintent); This is an agile, loosely coupled, asynchronous approach. This is a classic example of the flexibility provided by late binding. 32

Inter-Process Communication - Intents From Google s Developer s Reference: Three of the core components of an application activities, services, and broadcast receivers are activated through messages, called intents. Intent messaging is a facility for late run-time binding between components in the same or different applications. In each case, the Android system finds the appropriate activity, service, or set of broadcast receivers to respond to the intent, instantiating them if necessary. There is no overlap within these messaging systems: Broadcast intents are delivered only to broadcast receivers, never to activities or services. An intent passed to startactivity() is delivered only to an activity, never to a service or broadcast receiver, and so on. 33

Some Intent Constants Constant Target Component Action ACTION_CALL Activity Initiate a phone call ACTION_EDIT Activity Display data for the user to edit ACTION_MAIN Activity Start of a task ACTION_BATTE RY_LOW Broadcast receiver A warning that the battery is low 34

Intent Filters To inform the system which implicit intents they can handle, activities, services, and broadcast receivers can have one or more intent filters. Each filter describes a capability of the component, a set of intents that the component is willing to receive. It, in effect, filters intents of a desired type, while filtering out unwanted intents.. From Google s Android Developers Documentation. 35

Inter-Process Communication - Intents Activity 1 Create an Intent Object Set its action. Set a URI. Set a MIME type call startactivityforresult with the Intent object The onactivityresult method is called when a result is available Process A Activity 2 Launched because its intent filter matches the MIME type and action return a new Intent object to the activity that started this instance Process B 36

Inter-Process Communication Remote Methods and AIDL AIDL (Android Interface Definition Language) is an IDL language used to generate code that enables two processes on an Android-powered device to talk using interprocess communication (IPC). If you have code in one process (for example, in an Activity) that needs to call methods on an object in another process (for example, a Service), you would use AIDL to generate code to marshall the parameters. The AIDL IPC mechanism is interface-based, similar to COM or Corba, but lighter weight. It uses a proxy class to pass values between the client and the implementation. From Google s Android Developers Documentation. 37

Inter-Process Communication Remote Methods and AIDL Activity 1 3. Invoke the method. The caller thread is blocked until the return. Used to create client side proxy code that creates Parcel objects. Process A Service 2 1. Define an interface in AIDL. 2. Implement the interface. At run time the Parcel is unflattened. Process B AIDL is a java interface with in, out, and inout parameters. 38