ECWM511 MOBILE APPLICATION DEVELOPMENT Lecture 1: Introduction to Android



Similar documents
ECWM511 MOBILE APPLICATION DEVELOPMENT Lecture 1: Introduction to Android

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

Android Basics. Xin Yang

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

Android Architecture. Alexandra Harrison & Jake Saxton

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

Creating and Using Databases for Android Applications

Lecture 1 Introduction to Android

Introduction to Android. CSG250 Wireless Networks Fall, 2008

ITG Software Engineering

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

Introduction to Android

Praktikum Entwicklung Mediensysteme (für Master)

ANDROID PROGRAMMING - INTRODUCTION. Roberto Beraldi

A Short Introduction to Android

Android Fundamentals 1

Frameworks & Android. Programmeertechnieken, Tim Cocx

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

An Introduction to Android

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

Mobile Applications Grzegorz Budzyń Lecture. 2: Android Applications

AndroLIFT: A Tool for Android Application Life Cycles

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

Hacking your Droid ADITYA GUPTA

Android Operating System

Android For Java Developers. Marko Gargenta Marakana

CS378 -Mobile Computing. Android Overview and Android Development Environment

Android Mobile App Building Tutorial

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

Android (Basic + Advance) Application Development

Mobile Phones Operating Systems

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

Development. SriSeshaa Technologies. Table of Contents

Workshop on Android and Applications Development

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

ANDROID PROGRAMMING - INTRODUCTION. Roberto Beraldi

Example of Standard API

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

ANDROID. Programming basics

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

Introduction to NaviGenie SDK Client API for Android

Android Development. Marc Mc Loughlin

Remote Desktop on Mobile

ANDROID BASED MOBILE APPLICATION DEVELOPMENT and its SECURITY

What Readers Are Saying About Hello, Android

Jordan Jozwiak November 13, 2011

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

Introduction to Android SDK Jordi Linares

06 Team Project: Android Development Crash Course; Project Introduction

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

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

Android Application Development

ANDROID OPERATING SYSTEM

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

Introduction to Android

Mobile App Testing Guide. Basics of Mobile App Testing

Mobile Application Development 2014

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

5 reasons to choose Streamezzo SDK over Android SDK Page 2

Mobile Application Development Android

Programming with Android

Mono for Android Activity Lifecycle Activity Lifecycle Concepts and Overview

Building an Android client. Rohit Nayak Talentica Software

Issues in Android on Mobile Platform and Their Resolution

Mocean Android SDK Developer Guide

Overview of CS 282 & Android

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

ANDROID INTRODUCTION TO ANDROID

Basics of Android Development 1

Introduction to Android Programming (CS5248 Fall 2015)

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

Android Application Development

Android Operating System:

Developing Applications for ios

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

Mobile App Design and Development

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

Programming the Android Platform. Logistics

Introduction to Android

A Modular Approach to Teaching Mobile APPS Development

DEVELOPING MOBILE APPLICATIONS USING ANDROID

Android Architecture Diagram:

Android Application Development - Exam Sample

ipad, a revolutionary device - Apple

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

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

How To Develop Android On Your Computer Or Tablet Or Phone

ECE 455/555 Embedded System Design. Android Programming. Wei Gao. Fall

Publishing to TIZEN Using the Automated Conversion/Repackaging of Existing Android Apps. Hyeokgon Ryu, Infraware Technology, Ltd.

Medstar Health Dell Services

The Android Platform

Getting started with Android and App Engine

Android Developer Fundamental 1

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

Transcription:

Why Android? ECWM511 MOBILE APPLICATION DEVELOPMENT Lecture 1: Introduction to Android Dr Dimitris C. Dracopoulos A truly open, free development platform based on Linux and open source A component-based architecture Tons of built-in services out of the box (GPS, SQL, browser and map views) Automatic management of the application life cycle High-quality graphics and sound 3D-accelerated OpenGL graphics various codecs for audio and video formats built-in Portability across a wide range of current and future hardware (apps in Java) 2 / 23 Architecture 3 / 23 1 2

Native Libraries Surface Manager: drawing commands go into off-screen bitmaps that are then combined with other bitmaps to form the display the user sees. 2D and 3D graphics: Two- and three-dimensional elements can be combined in a single user interface with Android. The library will use 3D hardware if the device has it or a fast software renderer if it doesn t. Media codecs: Android can play video and record and play back audio in a variety of formats including AAC, AVC (H.264), H.263, MP3, and MPEG-4. SQL database: Android includes the lightweight SQLite database engine, the same database used in Firefox and the Apple iphone. Browser engine: For the fast display of HTML content, Android uses the Chromium library. Same engine used in the Google Chrome browser and close to Apple s Safari browser and the Apple iphone. 4 / 23 Application Framework Provides the high-level building blocks you will use to create your applications. Activity Manager Controls the life cycle of applications Maintains a common backstack for user navigation Content providers: Objects encapsulate data that needs to be shared between applications (e.g. contacts) Resource manager: Resources are anything that goes with your program that is not code Location manager: An Android phone always knows where it is Notification manager: Events such as arriving messages, appointments, proximity alerts, alien invasions, and more can be presented to the user 6 / 23 Android Runtime Core Java Libraries (different than Java SE but there is a substantial amount of overlap) Dalvik: Java virtual machine optimized for low memory requirements runs.dex files, which are converted at compile time from standard.class and.jar files..dex files are more compact and efficient than class files, an important consideration for the limited memory and battery-powered devices that Android targets. ART (Android 5.0 and newer): When an application is installed in a device, ART compiles it into machine code. 5 / 23 Applications and Widgets End users will see only these programs. Applications: Programs that can take over the whole screen and interact with the user Widgets: Operate only in a small rectangle of the Home screen application Android phones preprepackaged with a number of standard system applications, including: Phone dialer Email Contacts Web browser Google Play Store 7 / 23 3 4

It s Alive! Standard Linux or Windows desktop, you can have many applications running and visible at once in different windows. One of the windows has keyboard focus, but otherwise all the programs are equal. Android doesnt work that way: There is one foreground application, which typically takes over the whole display except for the status line. When the user turns on their phone, the first application they see is the Home application. When the user runs an application, Android starts it and brings it to the foreground. From that application, the user might invoke another application, or another screen in the same application, and then another and another. All these programs and screens are recorded on the application stack by the system s Activity Manager. At any time, the user can press the Back button to return to the previous screen on the stack. Building Blocks of an Application Activities: A user interface screen. Applications can define one or more activities to handle different phases of the program.each activity is responsible for saving its own state so that it can be restored later as part of the application life cycle. Activities extend the Context class, so you can use them to get global information about your application. Fragments: Components of an activity. They can be visible but they don t have to be. Using fragments allows you to more easily adapt to different-sized scre ens. 10 / 23 8 / 23 An example of Fragments Handset selecting an item starts Activity B Tablet selecting an item updates Frgment B Process!= Application Each user interface screen is represented by an Activity class. Each activity has its own life cycle. An application is one or more activities plus a Linux process to contain them. In Android, an application can be alive even if its process has been killed (the activity life cycle is not tied to the process life cycle). Processes are just disposable containers for activities. 9 / 23 Activity A contains Fragment A Activity B contains Fragment B Activity A contains Fragments A and Fragment B Figure 1: An example of an application in which 2 separate UI modules implemented by fragments can be embedded in a single activity for a tablet design but separated for a handset design. 11 / 23 5 6

Building Blocks of an Application (cont d) Views: A view is the smallest level of the user interface. Views are contained directly by activities or by fragments inside activities. They can be created by Java code, or preferably, by XML layouts. 12 / 23 Building Blocks of an Application (cont d) Content Providers: a set of data wrapped up in a custom API to read and write it. This is the best way to share global data between applications. Example: Google provides a content provider for contacts. All the information there - names, addresses, phone numbers, and so forth, can be shared by any application that wants to use it. 14 / 23 Life cycle of an Android activity Building Blocks of an Application (cont d) Intents: A mechanism for describing a specific action, such as pick a photo, or phone home. Example: there is an intent for send an email.if youre writing a new email application, you can register an activity to handle that intent and replace the standard mail program.the next time somebody tries to send an email, theyll get the option to use your program instead of the standard one. Services: A task that runs in the background without the users direct interaction, similar to a Unix daemon. Example: a music player. The music may be started by an activity, but you want it to keep playing even when the user has moved on to a different program. 13 / 23 15 / 23 7 8

Life cycle of an Android activity oncreate(bundle): This is called when the activity first starts up. onstart(): This indicates the activity is about to be displayed to the user. onresume(): This is called when your activity can start interacting with the user. This is a good place to start animations and music. onpause(): This runs when the activity is about to go into the background, usually because another activity has been launched in front of it. This is where you should save your programs persistent state. Things like stopping animation, music should be done here as well. Avoid CPU intensive tasks in here, such as a database writing. onstop(): This is called when your activity is no longer visible to the user and it wont be needed for a while. If memory is tight, onstop( ) may never be called (the system may simply terminate your process). Lifecycle of a Fragment Similar to that of an Activity. The following lifecycle methods have to be implemented at least: oncreate(): Called when creating the fragment. Initialize essential components of the fragment that you want to retain when the fragment is paused or stopped, then resumed. oncreateview(): Called it is time for the fragment to draw its UI. onpause(): First indication that the user is leaving the fragment (though it does not always mean the fragment is being destroyed). Commit any changes that should be persisted beyond the current user session (because the user might not come back). 18 / 23 16 / 23 Life cycle of a Fragment (cont d) Life cycle of an Android activity (cont d) onrestart(): If this method is called, it indicates your activity is being redisplayed to the user from a stopped state. ondestroy(): This is called right before your activity is destroyed. onsaveinstancestate(bundle): Android will call this method to allow the activity to save per-instance state, such as a cursor position within a text field. Usually you wont need to override it because the default implementation saves the state for all your user interface controls (Views) automatically. onrestoreinstancestate(bundle): This is called when the activity is being reinitialized from a state previously saved by the onsave- InstanceState( ) method. The default implementation restores the state of your user interface. 17 / 23 19 / 23 9 10

Using Resources A resource is a localized text string, bitmap, or other small piece of noncode information that your program needs. At build time all your resources get compiled into your application. You create and store your resources in the res directory inside your project. The Android resource compiler (aapt) processes resources according to which subfolder they are in and the format of the file. For example: PNG and JPG format bitmaps should go in a directory starting with res/drawable XML files that describe screen layouts should go in a directory starting with res/layout 20 / 23 Safety and Security (cont d) Some of the most common permissions are: INTERNET: Access the Internet. READ CONTACTS: Read (but dont write) the user s contacts data. WRITE CONTACTS: Write (but dont read) the user s contacts data. RECEIVE SMS: Monitor incoming SMS (text) messages. ACCESS COARSE LOCATION: Use a coarse location provider such as cell towers or wifi. ACCESS FINE LOCATION: Use a more accurate location provider such as GPS. For example, to monitor incoming SMS messages, you would specify this in the manifest file: 22 / 23 Safety and Security Every application runs in its own Linux process. The hardware forbids one process from accessing another process s memory. Every application is assigned a specific user ID. Any files it creates cannot be read or written by other applications. In addition: Access to certain critical operations are restricted, and you must specifically ask for permission to use them in a file named Android-Manifest.xml. When the application is installed, the Package Manager either grants or doesn t grant the permissions based on certificates and, if necessary, user prompts. 21 / 23 Safety and Security (cont d) <manifest xmlns:android="http://schemas.android.com/ apk/res/android" package="com.google.android.app.myapp" > <uses-permission android:name= "android.permission.receive_sms" /> </manifest> 23 / 23 11 12