Android Software Development Kit (Part I)

Similar documents
Android Overview. Most of the material in this section comes from

Lecture 1 Introduction to Android. App Development for Mobile Devices. App Development for Mobile Devices. Announcement.

INTERNATIONAL JOURNAL OF PURE AND APPLIED RESEARCH IN ENGINEERING AND TECHNOLOGY

Introduction To Android

Introduction to Android Application Development. Mike Kvintus Principal Engineer JDSU

Android Development Tutorial. Yi Huang

Mobile Computing. Introduction to Android

Android Basics. - Bhaumik Shukla Android Application STEALTH FLASH

Produced by. Mobile Application Development. David Drohan Department of Computing & Mathematics Waterford Institute of Technology

SHWETANK KUMAR GUPTA Only For Education Purpose

Introduction to Android Android Smartphone Programming. Outline University of Freiburg. What is Android? Background University of Freiburg.

Android App Development. Muhammad Sharjeel COMSATS Institute of Information Technology, Lahore

Introduction to Android

Chapter 1 Hello, Android

COMP4521 EMBEDDED SYSTEMS SOFTWARE

Understand applications and their components. activity service broadcast receiver content provider intent AndroidManifest.xml

Applications. Marco Ronchetti Università degli Studi di Trento

Android. Operating System and Architecture. Android. Screens. Main features

Android - open source mobile platform

CSCU9YH Development with Android

Android Overview. Francesco Mercaldo, PhD

Android Ecosystem and. Revised v4presenter. What s New

Introduction to Android

Mobile and Wireless Systems Programming

Programming Concepts and Skills. Creating an Android Project

Mobile Application Development - Android

Introduction to Android

Android Development Tools = Eclipse + ADT + SDK

application components

CS260 Intro to Java & Android 04.Android Intro

M O B I L E T R A I N I N G. Beginning Your Android Programming Journey

Security model. Marco Ronchetti Università degli Studi di Trento

IJRDTM Kailash ISBN No Vol.17 Issue

Android App Development

Real-Time Embedded Systems

ANDROID SYLLABUS. Advanced Android

Android System Architecture. Android Application Fundamentals. Applications in Android. Apps in the Android OS. Program Model 8/31/2015

Android App Development

Getting started: Installing IDE and SDK. Marco Ronchetti Università degli Studi di Trento

Android. Mobile operating system developed by Google A complete stack. Based on the Linux kernel Open source under the Apache 2 license

Praktikum Entwicklung von Mediensystemen mit Android

INTRODUCTION TO ANDROID

Abstract. 1. Introduction

PAPER ON ANDROID ESWAR COLLEGE OF ENGINEERING SUBMITTED BY:

Android is a software stack for mobile devices and comprises middleware, operating system and core

How to Set up Eclipse and Android SDK Manager Environment You need to download the following

BCA 6. Question Bank

COSC 3P97 Mobile Computing

SD Module- Android Programming

EMBEDDED SYSTEMS PROGRAMMING Application Basics

Android Fundamentals - Part 1

An Introduction to Android. Jason Chen Developer Advocate Google I/O 2008

Android. Lesson 1. Introduction. Android Developer Fundamentals. Android Developer Fundamentals. to Android 1

App Development for Android. Prabhaker Matet

ANDROID APPS (NOW WITH JELLY BEANS!) Jordan Jozwiak November 11, 2012

Embedded Systems Programming - PA8001

CS 4518 Mobile and Ubiquitous Computing Lecture 2: Introduction to Android. Emmanuel Agu

Application Development Setup Guide

Another difference is that the kernel includes only the suspend to memory mechanism, and not the suspend to hard disk, which is used on PCs.

User Interface Design & Development

Mobile and Ubiquitous Computing: Android Programming (part 1)

Developing Android applications in Windows

Android App Development. Ahmad Tayeb

Android. (XKE Mars 2009) Erwan Alliaume.

Developer s overview of the Android platform

8/30/15 MOBILE COMPUTING. CSE 40814/60814 Fall How many of you. have implemented a command-line user interface?

UNIT:2 Introduction to Android

Mobile OS. Symbian. BlackBerry. ios. Window mobile. Android

Questions and Answers. Q.1) Which of the following is the most ^aeuroeresource hungry ^aeuroepart of dealing with activities on android?

Android Programming in Bluetooth Cochlea Group

CS 528 Mobile and Ubiquitous Computing Lecture 1b: Introduction to Android. Emmanuel Agu

CS378 -Mobile Computing. Services and Broadcast Receivers

Praktikum Mobile und Verteilte Systeme. Android-Basics. Prof. Dr. Claudia Linnhoff-Popien André Ebert, Sebastian Feld

Introduction What is Android?

Lecture 1 - Introduction to Android

Android-Basics. Praktikum Mobile und Verteilte Systeme. Prof. Dr. Claudia Linnhoff-Popien André Ebert, Sebastian Feld

Syllabus- Java + Android. Java Fundamentals

Mobile Application Development

Tutorial on Basic Android Setup

LECTURE NOTES ON MOBILE APPLICATION DEVELOPMENT

Android App Development Workshop

android application development CONTENTS 1.1 INTRODUCTION TO O ANDROID OPERATING SYSTEM... TURES Understanding the Android Software Stack...

ATC Android Application Development

UNDERSTANDING ACTIVITIES

DROID. By S.Gokulakrishnan AP/CSE SCSVMV

Developing Applications for ios

Android Application Development. By : Shibaji Debnath

Group B: Assignment No 8. Title of Assignment: To verify the operating system name and version of Mobile devices.

An Android Application for Remote Ringer

Programming in Android. Nick Bopp

Lecture 2 Android SDK

ios vs Android By: Group 2

Android" Application Development SAMS. Sams Teach Yourself. Shane Conder. Lauren Darcey. Second Edition

Configuring the Android Manifest File

Android Application Development

COLLEGE OF ENGINEERING, NASHIK-4

Android Internals and the Dalvik VM!

CS378 -Mobile Computing. Anatomy of and Android App and the App Lifecycle

Introduction to Mobile Application and Development

Around Android. Essential Android features illustrated by a walk through a practical example

Transcription:

Android Software Development Kit (Part I) Gustavo Alberto Rovelo Ruiz October 29th, 2010 Look & Touch Group

2 Presentation index What is Android? Android History Stats Why Andriod? Android Architecture Application Fundamentals Settingup your development environment Hello Android Example Bibliography

3 What is Android? Is a software stack for mobile devices. Includes: An operating system. Middleware. Key applications. The Android SDK provides: Tools and APIs to develop applications on the Android platform. It uses the Java programming language.

4 Android History 08/11/2007 Android SDK 1st beta version More than 70 million smart phones were sold in 2007.

5 Stats Smartphone Stats are In: Apple and Android are on the Rise by Matt Klassen on February 24, 2010 http://www.thetelecomblog.com/2010/02/24/smartphone-stats-are-in-apple-and-android-are-on-the-rise/

6 Why Android? Some of the problems that Android tries to solve are: Fragmentation Each company has its own application Env. Particulary for those Linux based phones. Propietary software stacks Microsoft s Windows Mobile, Nokia s N series Symbian OS Linux based are partially open source. Closed Networks Adding a new application can be complicated even when the OS allows it, because some operators block the phones to preserve their network integrity.

7 Android Architecture Features Application framework enabling reuse and replacement of components. Dalvik virtual machine optimized for mobile devices. Integrated browser based on the open source WebKit engine. Custom 2D graphics library. OpenGL ES 1.0 specification (hardware acceleration optional) for 3D graphics.

8 Android Architecture Features Media support (MPEG4, MP3, AAC, JPG, PNG, GIF). Camera, accelerometer (hardware dependent). DevEnv including Device emulator. Debugging tools. Memory and performance profiling. Plugin for the Eclipse IDE.

9 Android Architecture

10 Android Architecture Applications Email client. SMS program. Calendar. Maps. Browser. Contacts. All written using Java.

11 Android Architecture Application Framework Open Dev platform. Developers are free to take advantage of the device hardware, e.g. access location information. Reuse of components; any application can publish its capabilities. Services and systems, including: Views. Content providers. Resource manager. Notification Manager. Activity Manager.

12 Android Architecture Libraries A set of C/C++ libraries exposed through the application framework: System C library - a BSD-derived implementation of the standard C system library (libc). Media Libraries - based on PacketVideo's OpenCORE. Surface Manager - manages access to the display subsystem. LibWebCore - powers the Android browser and an embeddable web view. SGL - the underlying 2D graphics engine. 3D libraries - OpenGL ES 1.0 APIs. FreeType - bitmap and vector font rendering. SQLite - a relational database engine available to all applications.

13 Android Architecture Android Runtime Java Core libraries functionality. Every Android application runs in its own process, with its own instance of the Dalvik virtual machine. With Dalvik a device can run multiple VMs efficiently. The Dalvik VM relies on the Linux kernel for underlying functionality such as threading and low-level memory management.

14 Android Architecture Linux Kernel Linux version 2.6 Core system services such as security, memory management, process management, network stack, and driver model. The kernel also acts as an abstraction layer between the hardware and the rest of the software stack.

15 Application Fundamentals. Android Execution Environment Limited Resources Battery. Processor clock rates. Memory. Mobile mashups An application can incorporate existing applications. Google Maps. Interchangeable applications Services in the OS are independent of the applications (e.g. Sending e-mail).

16 Application Fundamentals All the applications are compiled with Java. Compiled code + Data + Resource Files = an Android package A file marked by an.apk suffix. Distribute and install the application on mobile devices. It's the file users download to their devices. All the code in a single.apk file is considered to be one application.

17 Application Fundamentals In many ways, each Android application lives in its own world: By default, every application runs in its own Linux process. Each process has its own virtual machine (VM). By default, each application is assigned a unique Linux user ID. It's possible to arrange for two applications to share the same user ID, in which case they will be able to see each other's files. They can also arrange to run in the same Linux process, sharing the same VM.

18 Application Fundamentals One application can make use of elements of other applications. Using neither code nor links to the other application. It simply starts up that piece of the other application when the need arises. Needed work: Start an application process when any part of it is needed. Instantiate the Java objects for that part.

19 Application Fundamentals There are four types of components: Activities Presents a visual user interface for one focused endeavor the user can undertake. Services Runs in the background for an indefinite period of time. Broadcast receivers Receive and react to broadcast announcements. Content providers Makes a specific set of the application's data available to other applications.

20 Application Fundamentals Activities A text messaging application Shows a list of contacts to send messages to. Write the message to the chosen contact. Review old messages or change settings. Though they work together to form a cohesive user interface, each activity is independent of the others. Each one is implemented as a subclass of the Activity base class.

21 Application Fundamentals Activities An application might consist of just one activity or, it may contain several. Typically, one of the activities is the first that should be presented to the user when the application is launched. Each activity is given a default window to draw in. Full screen or float on top of other windows. An activity can also make use of additional window A pop-up dialog.

22 Application Fundamentals Services A music player is a good example of an Android Service. It can have some Activities that allow the user to select the song and play it. Users will expect the music to keep playing even after they leave the player and begin something different. An interface to communicate with an ongoing service. this interface might allow users to pause, rewind, stop, and restart the playback. As the Activities, Services run in their own process. Specially when it is a time-consuming task.

23 Application Fundamentals Broadcast receivers System BC = Time zone has changed, Battery is low, Picture has been taken,. An application can have any number of broadcast receivers. Broadcast receivers may start an activity or they may use the NotificationManager to alert the user. Notifications can get the user's attention in various ways flashing the backlight, vibrating the device, playing a sound, and so on. They typically place a persistent icon in the status bar, which users can open to get the message.

24 Application Fundamentals Content providers The data can be stored in the file system, in an SQLite database, or in any other manner that makes sense. Applications use a ContentResolver object to communicate with Content providers. Whenever there's a request that should be handled by a particular component: Android makes sure that the application process of the component is running. And that an appropriate instance of the component is available.

25 Application Fundamentals Component life cycle Is formed by all the states in which they may be, from the time they are instantiated until they are destroyed.

Main states 26 Application Fundamentals Activities life cycle Active or Running. Paused. Stopped. The life cycle can be implemented using 7 methods. Three loops to control Entire life time. Visible life time. Foreground life time.

27 Application Fundamentals Services life cycle Two loops to control Entire life time. Active life time. Broadcast reciver Life cycle Is only active while is executing the code in it s onreceive() method.

28 Application Fundamentals Processes and lifecycles 5 levels in the elimination hierarchy A foreground process An activity that the user is interacting with. It hosts an active service. It has a broadcast receiver executing its onreceive() method. A visible process It doesn't have any foreground components, but still affect what the user sees on screen. A Paused Activity. It hosts a service that's bound to a visible activity. They are considered extremely important.

29 Application Fundamentals Processes and lifecycles A service process Is running a service that has been started with the startservice(). They are generally doing things that the user cares about (playing an mp3). A background process Holding an activity that's not currently visible to the user. Can be killed at any time to reclaim memory for a foreground, visible, or service process. LRU (least recently used) list to ensure most recently seen by the user is the last to be killed. An empty process A cache to improve startup time the next time a component needs to run in it.

30 Application Fundamentals The manifest file It is bundled into the Android package. Is a structured XML file. Always named AndroidManifest.xml Declare Apps components. Name any libraries the application needs to be linked against (besides the default Android library). Identifying any permissions the application expects to be granted.

31 Application Fundamentals <?xml version="1.0" encoding="utf-8"?> <manifest... > <application... > <activity android:name="com.example.project.freneticactivity" android:icon="@drawable/small_pic.png" android:label="@string/freneticlabel"... > </activity>... </application> </manifest> <service> elements for services <receiver> elements for broadcast receivers <provider> elements for content providers. Only broadcast receivers can either be declared in the manifest, or they can be created dynamically in code.

32 Settingup your development environment The following steps are the directions to set an Android Development Environment on a PC running Windows. Everything for free :D

33 Settingup your development environment Installing JDK Android SDK requires JDK version 5 or 6. http://java.sun.com/javase/downloads Register yourself in the Sun Developer Network (SDN). Choose the Java SE Development Kit for Windows, Multi-language. Follow assistant instructions.

34 Settingup your development environment Install Eclipse Version 3.4 or 3.5 recommended. Version 3.6 has some reported issues with the ADT Plugin. http://www.eclipse.org/downloads Use the package labeled as: Eclipse IDE for Java Developers. Unizp the content of the downloaded file to a convinient location: C:/Eclipse.

35 Settingup your development environment Check for required plugins Make sure the Java Development Tool (JDT) and the Web Standard Tools (WST) are installed: Start Eclipse, Menu option: Windows Preferences. The list of preferences should inclue one entry for: Java. XML / Web and XML. Installing Eclipse IDE for Java Developers will automatically get the needed plugins.

36 Settingup your development environment Install Android SDK http://developer.android.com/sdk/index.html Extract the folder content int a convinient location: C:\AndroidSDK. Update Environment variable Path: Add the full path of the tools directory in the AndroidSDK folder.

37 Settingup your development environment Install the Android Development Tool (ADT) plugin In Eclipse choose Help Menu Install new software. Type this site: https://dl-ssl.google.com/android/eclipse/ and click Add. In the Search Results dialog Select the checkbox for Android Plugin Developer Tools and click Next. You will receive a warning indicating that the plugin is not signed; install it anyway. Restart Eclipse. Choose Menu Window Preferences and then select Android from the left column. Use the Browse button to navigate to the place you install the Android SDK, click Apply and the Ok.

38 Settingup your development environment Add Android platforms and other components to your SDK Select Available Packages. Select Components. Install.

39 Settingup your development environment Update Installed packages Select Installed packages. Select the package to update. Or Update All.

40 Settingup your development environment Android Virtual Devices (AVD) Run any app in the Android emulator. Independent virtual device, with its own hardware options, system image, and data storage. Model different device environments in the Android emulator. AVD Manager either through Eclipse or through the Android tool. The android tool also offers a command-line interface for creating and managing AVDs.

41 Settingup your development environment Creating an AVD Use the Android SDK and AVD Manager from the Window Menu in Eclipse. Select Virtual devices from the left panel. Click New button Stored in C:\Users\<user>\.android\

42 Settingup your development environment Setting hardware emulation options Device RAM size. Touch-screen support. Keyboard support. GSM modem support. Camera support. Battery support. GPS support. Accelerometer.

43 Hello Android example File >New > Project > Android Project > Next Android applications are forward-compatible

44 Hello Android example Here is a description of each field: Project Name The name of the directory that will contain the project files. Application Name The name that will appear on the Android device. Package Name Following the same rules as for packages in Java. This also sets the package name under which the Activity will be generated. The name must be unique across all packages installed on the Android system. It's important to use a standard domain-style package for your applications. "com.example" namespace, is reserved for example documentation. Your own applications, should use a namespace that's appropriate to your organization or entity. Create Activity Name for the class that will be generated by the plugin. This will be a subclass of Android's Activity class. Min SDK Version This value specifies the minimum API Level required by your application.

45 Hello Android example Open HelloAndroid.java package com.example.helloandroid; import android.app.activity; import android.os.bundle; public class HelloAndroid extends Activity { /** Called when the activity is first created. */ @Override public void oncreate(bundle savedinstancestate) { super.oncreate(savedinstancestate); setcontentview(r.layout.main); } } A Context is a handle to the system Provides services like resolving resources, obtaining access to databases and preferences, and so on. The Activity class inherits from Context, and because your HelloAndroid class is a subclass of Activity, it is also a Context. So, you can pass this as your Context reference to the TextView.

46 Hello Android example Run the application Menu Run > Run. Select Android Application.

47 Bibliography Android Developers Documentation http://developer.android.com/guide/developing/eclipse-adt.html Rogers Rick, Lombardo John, Mednieks Zigurd, Meike Blake. Android, Application Development. O Reilly. 2009

48 Thank you for your attention