Mobile Application Development Android



Similar documents
Android Basics. Xin Yang

Lecture 1 Introduction to Android

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

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

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

Mobile Application Development 2014

Getting Started: Creating a Simple App

Jordan Jozwiak November 13, 2011

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

Introduction to Android Development. Jeff Avery CS349, Mar 2013

Android Tutorial. Larry Walters OOSE Fall 2011

ANDROID BASED MOBILE APPLICATION DEVELOPMENT and its SECURITY

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

Android Developer Fundamental 1

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

Getting started with Android and App Engine

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

Android Development. Marc Mc Loughlin

Introduction to Android

Programming with Android

ECWM511 MOBILE APPLICATION DEVELOPMENT Lecture 1: Introduction to Android

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

UNIVERSITY AUTHORISED EDUCATION PARTNER (WDP)

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

Android Programming and Security

Chapter 2 Getting Started

Workshop on Android and Applications Development

GETTING STARTED WITH ANDROID DEVELOPMENT FOR EMBEDDED SYSTEMS

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

Introduction to Android SDK Jordi Linares

Presenting Android Development in the CS Curriculum

Android For Java Developers. Marko Gargenta Marakana

Frameworks & Android. Programmeertechnieken, Tim Cocx

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

MMI 2: Mobile Human- Computer Interaction Android

Praktikum Entwicklung Mediensysteme (für Master)

Open Source Telemedicine Android Client Development Introduction

Android Geek Night. Application framework

ECWM511 MOBILE APPLICATION DEVELOPMENT Lecture 1: Introduction to Android

5 reasons to choose Streamezzo SDK over Android SDK Page 2

Android Architecture. Alexandra Harrison & Jake Saxton

Android Application Development - Exam Sample

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

Android Application Development Lecture Notes INDEX

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

ITG Software Engineering

How To Develop Android On Your Computer Or Tablet Or Phone

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

4. The Android System

RoverPal - A Mobile Payment Application

Android Java Live and In Action

Smartphone market share

Overview of CS 282 & Android

Android Environment SDK

CS378 -Mobile Computing. Android Overview and Android Development Environment

How to develop your own app

Running a Program on an AVD

ODROID Multithreading in Android

Introduction to NaviGenie SDK Client API for Android

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)

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

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

Hacking your Droid ADITYA GUPTA

Mobile Application Development

What is Android? originally purchased from Android, Inc. in 2005

The Android Platform

Praktikum Entwicklung von Mediensystemen (Android)

Android Mobile App Building Tutorial

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

Programming the Android Platform. Logistics

Fachbereich Informatik und Elektrotechnik SunSPOT. Ubiquitous Computing. Ubiquitous Computing, Helmut Dispert

Introduction to Android

The power of root on Android emulators

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

An Easier Way for Cross-Platform Data Acquisition Application Development

Mocean Android SDK Developer Guide

Monitoring, Tracing, Debugging (Under Construction)

ANDROID PROGRAMMING - INTRODUCTION. Roberto Beraldi

Android ( ) Frank Ducrest

Tutorial on Basic Android Setup

Android Operating System:

Homework 9 Android App for Weather Forecast

Hello World. by Elliot Khazon

Java Garbage Collection Basics

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

Android Application Development Course Program

Creating and Using Databases for Android Applications

Mobile Devices - An Introduction to the Android Operating Environment. Design, Architecture, and Performance Implications

Introduction to Android Programming (CS5248 Fall 2015)

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

IOIO for Android Beginners Guide Introduction

Synthesis for Developing Apps on Mobile Platforms

Android: Setup Hello, World: Android Edition. due by noon ET on Wed 2/22. Ingredients.

Transcription:

Mobile Application Development Android MTAT.03.262 Satish Srirama satish.srirama@ut.ee

Goal Give you an idea of how to start developing Android applications Introduce major Android application concepts Walk you through some sample applications in the development environment 9/4/2015 Satish Srirama 2/37

References & Books Android developers http://developer.android.com/ Books Professional Android 4 Application Development, By Reto Meier 9/4/2015 Satish Srirama 3/37

Dealing with problems & Help Have created a mailing list mclab DOT mad AT lists DOT ut DOT ee Post your question to mailing list Practicals assistants: Mohan Liyanage (liyanage AT ut DOT ee) Jakob Mass (jaks AT ut DOT ee) Also created a Google group https://groups.google.com/forum/#!forum/mob appdev mtat03262 ut Post your questions there Keep answering your friends 9/4/2015 Satish Srirama 4/37

What is Android? Android is not a device or a product It s not even limited to phones you could build a handheld GPS, an MP3 player, TV, Watch etc. A free, open source mobile platform Open Handset Alliance 100+ technology companies Commitment to openness, shared vision, and concrete plans A Linux based, multiprocess, multithreaded OS The Android operating system is a multi user Linux system in which each application is a different user 9/4/2015 Satish Srirama 5/37

Android applications are written in Java package com.google.android.helloactivity; import android.app.activity; import android.os.bundle; public class HelloActivity extends Activity { public HelloActivity() { } @Override public void oncreate(bundle icicle) { super.oncreate(icicle); setcontentview(r.layout.hello_activity); } } 9/4/2015 Satish Srirama 6/37

Android applications are compiled to Dalvik bytecode Write app in Java Compiled in Java dex2oat Loaded into Android Runtime (ART) Linux OS Transformed to Dalvik bytecode Android 5.X 9/4/2015 Satish Srirama Up to Android 4.4 Loaded into Dalvik VM Linux OS Android Platform 7/37

Android's ART vs Dalvik ART and Dalvik are compatible runtimes running Dex bytecode Dalvik is based on JIT (just in time) compilation Each time an app is run, the part of the code required for its execution is going to be translated (compiled) to machine code It has a smaller memory footprint and uses less physical space on the device ART compiles the intermediate language, Dalvik bytecode, into a system dependent binary Whole code of the app will be pre compiled during install (once) Ahead of Time compiler (AOT) Installation process takes a bit longer Code executes much faster Less CPU usage as no more compilation required and this also results in less battery drain ART optimized the garbage collector (GC) 9/4/2015 Satish Srirama 8/37

Why Android/Dalvik Runtime? The Android/Dalvik runtime is optimized for mobile applications Runs multiple VMs efficiently Each application has its own VM Minimal memory footprint Relies on Linux kernel for threading and lowlevel memory management 9/4/2015 Satish Srirama 9/37

Android software stack 9/4/2015 Satish Srirama 10/37

Can assume that most devices have android 4.x or 5.x http://developer.android.com/about/dashboards/index.html http://en.wikipedia.org/wiki/android_version_history 9/4/2015 Satish Srirama 11/37

Android has a working emulator 9/4/2015 Satish Srirama 12/37

Getting started I hope all of you have Android Studio installed Downloaded the latest SDK tools and platforms (version 22) using the SDK Manager http://developer.android.com/training/basics/fir stapp/index.html 9/4/2015 Satish Srirama 13/37

Exercise: Hello World Let us create an AVD (Android virtual device) Create a New Android Project Construct the UI Run the Application Upgrade the UI to an XML Layout Let us debug 9/4/2015 Satish Srirama 15/37

Debugging in Android Traditional System.out.println is not available in the Android system We can debug through the app user interface Errors crash and close app Instead use Logging mechanisms Log.v(String tag, String message); tag > app name Message > debug message. Requires importing android.util.log Log messages appear in the LogCat component of the Android Studio interface 9/4/2015 Satish Srirama 16/37

What s in an Application? Libraries Default Activity Other Activities Services Content Android Manifest Drawable Layouts Values Assets 9/4/2015 Satish Srirama 17/37

File structure of applications code files Auto generated resource list images UI layouts Android Manifest constants 9/4/2015 Satish Srirama 18/37

Application Manifest Each Android project has a manifest file Defines the structure and metadata of the application Includes nodes for each of the application components (Activities, Services, Intents etc.) Also includes security permissions 9/4/2015 Satish Srirama 19/37

Application Manifest continued 9/4/2015 Satish Srirama 20/37

Security in Android Follows standard Linux guidelines Each application runs in its own process Process permissions are enforced at user and group IDs assigned to processes Finer grained permissions are then granted (revoked) per operations Apps declare permissions in manifest <uses-permission id="android.permission.receive_sms" /> 9/4/2015 Satish Srirama 21/37

Android Design Philosophy Applications should be: Fast Resource constraints: <200MB RAM, slow processor Responsive Apps must respond to user actions within 5 seconds Secure Apps declare permissions in manifest Seamless Usability is key, persist data, suspend services Android kills processes in background as needed 9/4/2015 Satish Srirama 22/37

Application priority and process states Android applications have limited control over their life cycles Each application runs in its own process Each process is running a separate instance of Dalvik/ART Memory and process management is handled by runtime Runtime may kill some services in the background Application priority is critical 9/4/2015 Satish Srirama 23/37

Application priority Reto Meier, Professional Android 2 Application Development, p 59 9/4/2015 Satish Srirama 24/37

Android application lifecycle Apps move through states during lifecycle Understanding app lifecycle is necessary, so that apps: Does not crash if the user receives a phone call or switches to another app while using your app Does not consume valuable system resources when the user is not actively using it Does not lose the user's progress if they leave your app and return to it at a later time Does not crash or lose the user's progress when the screen rotates between landscape and portrait orientation 9/4/2015 Satish Srirama 25/37

Android application lifecycle continued Transient states Static states 9/4/2015 Satish Srirama http://developer.android.com/training/basics/activity lifecycle/starting.html 26/37

The History of GUIs Hardcoded to the screen Hardcoded to the window Hardcoded within a view hierarchy Dynamic layout within a view hierarchy 9/4/2015 Satish Srirama 28/37

Generating GUIs in Android Two ways to create GUIs: in XML or in code 9/4/2015 Satish Srirama 29/37

Advantages of Declarative route via XML Separation of appearance (presentation) from actual meaningful state changing code Can change interface without having to completely recompile Java code Can just recompile XML View Resource is inflated at runtime 9/4/2015 Satish Srirama 30/37

Generating GUIs in Android continued A lot of your GUI related work will take place in: res/layout res/values @+id/name_for_component gives you handle for referencing XML declarations in code Button button = (Button) findviewbyid(r.id.button1); 9/4/2015 Satish Srirama 31/37

Working with resources Application resources are stored under res/ There are different types of resources String resources Saved in res/values/ and accessed from the R.string 9/4/2015 Satish Srirama 32/37 http://developer.android.com/guide/topics/resources/available resources.html

Working with resources continued Color resources Saved in res/color/ and accessed from the R.color class Style resources Saved in res/values/ and accessed from the R.style class Layout resources http://developer.android.com/guide/topics/resources/available resources.html 9/4/2015 Satish Srirama 33/37

Advantages of structured resources One can maintain resources independently and can group based on types Android selects which alternative resource to use at runtime Depending on the current device configuration Help in providing alternative resources based on device types Localizing the applications 9/4/2015 Satish Srirama 34/37

Supporting different screens Four generalized sizes small, normal, large, xlarge Four generalized densities low (ldpi), medium (mdpi), high (hdpi), extra high (xhdpi) res/layout res/layout-large res/layout-land-large res/drawable-ldpi res/drawable-hdpi http://developer.android.com/training/basics/supporting devices/screens.html 9/4/2015 Satish Srirama 35/37

Localizing the applications Supporting different languages res/values res/values-en res/values-fr Help in localizing the applications res/drawable-de-rde/ res/drawable-fr-rca/ http://developer.android.com/training/basics/supporting devices/languages.html 9/4/2015 Satish Srirama 36/37

Homework Play with life cycle methods Have a layout with 2 EditTexts and 2 TextViews and try to manage the input under different conditions like application paused, resumed, stopped, destroyed. Have the same application dealing with language, localization and landscape movement issues Upload the project to course tasks Deadline: A day before the next lecture. So 10 th September 2015. 9/4/2015 Satish Srirama 37/37