06 Team Project: Android Development Crash Course; Project Introduction



Similar documents
Android Sensors. CPRE 388 Fall 2015 Iowa State University

Android Sensors. XI Jornadas SLCENT de Actualización Informática y Electrónica

ELET4133: Embedded Systems. Topic 15 Sensors

Sensors & Motion Sensors in Android platform. Minh H Dang CS286 Spring 2013

Android Framework. How to use and extend it

Using Extensions or Cordova Plugins in your RhoMobile Application Darryn

Using the Android Sensor API

Frameworks & Android. Programmeertechnieken, Tim Cocx

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

Objective. Android Sensors. Sensor Manager Sensor Types Examples. Page 2

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

Android Basics. Xin Yang

Android Sensor Programming. Weihong Yu

Arduino & Android. A How to on interfacing these two devices. Bryant Tram

Android Development. Marc Mc Loughlin

Chapter 2 Getting Started

Introduction to Android SDK Jordi Linares

Android Geek Night. Application framework

Android Environment SDK

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

Android Development Tutorial. Nikhil Yadav CSE40816/ Pervasive Health Fall 2011

ECWM511 MOBILE APPLICATION DEVELOPMENT Lecture 1: Introduction to Android

How to Create an Android Application using Eclipse on Windows 7

Getting Started: Creating a Simple App

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

How to develop your own app

Android For Java Developers. Marko Gargenta Marakana

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

Android Java Live and In Action

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

Introduction to Android. CSG250 Wireless Networks Fall, 2008

Lecture 1 Introduction to Android

Introduction to Android Programming (CS5248 Fall 2015)

Android Environment SDK

Android Application Development

CS 403X Mobile and Ubiquitous Computing Lecture 6: Maps, Sensors, Widget Catalog and Presentations Emmanuel Agu

AndroLIFT: A Tool for Android Application Life Cycles

Developing Sensor Applications on Intel Atom Processor-Based Android* Phones and Tablets

Android Concepts and Programming TUTORIAL 1

Android app development course

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 Fundamentals 1

Programming Mobile Applications with Android

Android Development. 吳 俊 興 國 立 高 雄 大 學 資 訊 工 程 學 系

Mobile Application Development

Using Sensors on the Android Platform. Andreas Terzis Android N00b

Lab 1 (Reading Sensors & The Android API) Week 3

Android Security Lab WS 2014/15 Lab 1: Android Application Programming

Introduction to NaviGenie SDK Client API for Android

How to build your first Android Application in Windows

MMI 2: Mobile Human- Computer Interaction Android

ECWM511 MOBILE APPLICATION DEVELOPMENT Lecture 1: Introduction to Android

Programming with Android

Programming with Android: SDK install and initial setup. Dipartimento di Informatica: Scienza e Ingegneria Università di Bologna

Android Application Development - Exam Sample

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

Jordan Jozwiak November 13, 2011

App Development for Smart Devices. Lec #5: Android Sensors

Running a Program on an AVD

Tutorial #1. Android Application Development Advanced Hello World App

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)

Hello World. by Elliot Khazon

App Development for Android. Prabhaker Matet

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

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

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

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

Tutorial: Android Object API Application Development. SAP Mobile Platform 2.3 SP02

Programming with Android: SDK install and initial setup. Dipartimento di Informatica: Scienza e Ingegneria Università di Bologna

Developing NFC Applications on the Android Platform. The Definitive Resource

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

Android Programming Basics

IOIO for Android Beginners Guide Introduction

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

Android Tutorial. Larry Walters OOSE Fall 2011

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

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

Islamic University of Gaza. Faculty of Engineering. Computer Engineering Department. Mobile Computing ECOM Eng. Wafaa Audah.

Fahim Uddin 1. Java SDK

Introduction to Android Development. Jeff Avery CS349, Mar 2013

4. The Android System

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

Obsoleted chapter from The Busy Coder's Guide to Advanced Android Development

An Android-based Instant Message Application

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

ELDERLY SUPPORT - ANDROID APPLICATION FOR FALL DETECTION AND TRACKING TEJITHA RUDRARAJU. B.E, Anna University, India, 2011 A REPORT

Mobile Applications Grzegorz Budzyń Lecture. 2: Android Applications

Transcription:

M. Kranz, P. Lindemann, A. Riener 340.301 UE Principles of Interaction, 2014S 06 Team Project: Android Development Crash Course; Project Introduction April 11, 2014 Priv.-Doz. Dipl.-Ing. Dr. Andreas Riener Institute for Pervasive Computing Johannes Kepler University riener@pervasive.jku.at

Schedule for Today Team Project Assignment 4 Part 2 (user study execution) in-class discussion Android App Development Crash course Project Introduction and Launch Discussion: how, who, what, when? Principles of Interaction // 2014S // Slide < 2 >

Team Project >> Mensa Food Service Project phases Individual assignments Assignment 1: Literature review and analysis Assignment 2: Ideation and brainstorming Assignment 3: Development of mockups Assignment 4: User study Team work Part 1: Survey/Questionnaire Design Part 2: Execution Scenario and UI design Rapid prototyping (low-fidelity) Implementation (Android app) Evaluation with users (colleagues, classmates) The project team should discuss with the instructors and receive input on each phase of the project Some of the phases might be done through in-class HCI practice activities Principles of Interaction // 2014S // Slide < 3 >

Android Software Development Introduction

Android Developer System Setup Install Android SDK http://developer.android.com/sdk/index.html Contains SDK Tools and emulator In the SDK Manager, install the proposed packages To create a new emulated device, go to Tools > Manage AVDs (not needed in the exercise) Principles of Interaction // 2014S // Slide < 5 >

Android Developer System Setup Install Eclipse for Java Developers http://www.eclipse.org/downloads/packages/eclipse-classic-42/junor You can use an existing Eclipse installation, but we recommend using a fresh build, to avoid any conflicting bundles from the start. There is no interference between multiple Eclipse installations in different folders. Check if you have a Java Development Kit (JDK) installed, Java Runtime Environment (JRE) alone is not sufficient Principles of Interaction // 2014S // Slide < 6 >

Android Developer System Setup Install ADT Plugin for Eclipse Select Help > Install New Software Add a new Repository with location https://dl-ssl.google.com/android/eclipse/ Select Developer Tools Confirm and install, restart Eclipse Select Window > Preferences ; enter install folder in SDK Location ( /android-sdk) Principles of Interaction // 2014S // Slide < 7 >

Android Developer System Setup Install your phone software May include required drivers or platform tools e.g. for Samsung Galaxy, install Kies Enable USB Debugging on your phone (Settings > Applications > Development) More details: http://developer.android.com/sdk/installing/installing-adt.html Principles of Interaction // 2014S // Slide < 8 >

Android Developer System Setup Test Developer System Select File > New > Project Android Sample Project Select 2.3.3 Platform Create AccelerometerPlay Sample Connect your phone and deploy the sample (run as Android Application) If you run into problems, first check the online guide at http://developer.android.com/sdk/installing.html If it still does not work, consult our department forum at https://www.pervasive.jku.at/forum/ Principles of Interaction // 2014S // Slide < 9 >

Android Application Development

Android Basics Development in Java, virtual machine in Android is Dalvik Class library contains most packages from Java Standard Edition (excluding some, e.g. AWT and Swing) and introduces a large set additional packages (android.*) Compiled application is packaged in.apk file Each application runs in its own isolated process Applications are composed of one or several components: Activities, Services, Content Providers and Broadcast receivers If one component is in use, Android starts the application process and terminates it when it is no longer required Principles of Interaction // 2014S // Slide < 11 >

Android Basics Principles of Interaction // 2014S // Slide < 12 >

Application Components Activities (android.app.activity) implement user interface each Activity subclass represents a single screen with interaction elements, so called widgets (e.g. android.widget.button, android.widget.checkbox, ) Activities are independent, but can invoke each other and even activities from other applications (e.g. to select a contact from the contact list) one activity is designated as the main activity and will be shown when the application is started when another activity is started, the current activity is stopped and put on the back stack when an activity is closed, the last activity on the back stack is resumed Principles of Interaction // 2014S // Slide < 13 >

Application Components Activity life cycle oncreate: initialize onstart: becomes visible onresume: is in foreground onpause: will go to background onstop: is no longer visible ondestroy: is being terminated Principles of Interaction // 2014S // Slide < 14 >

Application Components Services (android.app.service) runs in the background and has no user interface might fetch data from the network or play music a service can be can be Started, Bound or both: Started: Service is started with startservice(); will run until it is terminated. Bound: Service is started when it is bound (when another component calls bindservice()) and is terminated as soon as the bound component terminates (or unbinds). Principles of Interaction // 2014S // Slide < 15 >

Application Components Service life cycle oncreate: initialize onstartcommand: is started service onbind: is bound service onunbind: all bound components have unbound or have been terminated ondestroy: is being terminated Principles of Interaction // 2014S // Slide < 16 >

Application Components Content providers (android.content.contentprovider) manages application data data can be stored in the file system or an SQLite database Android includes several Content providers, e.g. for the contact information Broadcast receivers (android.content.broadcastreceiver) responds to system wide announcements (e.g. screen turned off, battery low, ) intended to trigger Services or Activities Principles of Interaction // 2014S // Slide < 17 >

Resources and GUI Editor

Manifest AndroidManifest.xml every application needs one describes the application and all components in it declares needed permissions <?xml version="1.0" encoding="utf- 8"?> <manifest xmlns:android="http://schemas.android.com/apk/res/android" package="jku.mypackage" android:versioncode="1" android:versionname="1.0"> <uses- sdk android:minsdkversion="10" /> <application android:icon="@drawable/icon" android:label="@string/app_name"> <activity android:name=".helloworldactivity" 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> </manifest> Principles of Interaction // 2014S // Slide < 19 >

Resources Put each type of resource in specific subfolders of /res: e.g. Strings are defined in /res/values/strings.xml <?xml version="1.0" encoding="utf- 8"?> <resources> <string name="hello">hello</string> <string name="hi">@string/hello</string> </resources> Resources can usually be used in the application by specifying the resource id: sometextview.settext(r.string.hello); Read more about the specific resources and the corresponding folders at http://developer.android.com/guide/topics/resources/providing-resources.html Principles of Interaction // 2014S // Slide < 20 >

GUI Editor main.xml is created with each new project layouts are placed in /res/layout/ widgets can be dragged to the layout and the most common options adjusted advanced options can be edited directly in the generated.xml Principles of Interaction // 2014S // Slide < 21 >

GUI Editor To display a layout, set it as the active content view of an activity: public class HelloWorldActivity extends Activity { } /** Called when the activity is first created. */ @Override public void oncreate(bundle savedinstancestate) { } super.oncreate(savedinstancestate); setcontentview(r.layout.main); R contains all resource IDs and is generated automatically from the resources placed in /res Principles of Interaction // 2014S // Slide < 22 >

Sensors and acquiring sensor data

SensorManager and Sensors SensorManager (android.hardware.sensormanager) The SensorManager lets you access all the different sensors Retrieve the SensorManager with (SensorManager)getSystemService(SENSOR_SERVICE); Retrieve an instance of the Sensor you need sensormanager.getdefaultsensor(sensor.type_magnetic_field); Sensors: TYPE_ACCELEROMETER, TYPE_AMBIENT_TEMPERATURE, TYPE_GRAVITY, TYPE_GYROSCOPE, TYPE_LIGHT, TYPE_LINEAR_ACCELERATION, TYPE_MAGNETIC_FIELD, TYPE_PRESSURE, TYPE_PROXIMITY, TYPE_RELATIVE_HUMIDITY, TYPE_ROTATION_VECTOR Principles of Interaction // 2014S // Slide < 24 >

Accelerometer Sample public class SensorActivity extends Activity implements SensorEventListener { private final SensorManager msensormanager; private final Sensor maccelerometer; protected oncreate() { super.oncreate(); msensormanager = (SensorManager)getSystemService(SENSOR_SERVICE); maccelerometer = msensormanager.getdefaultsensor(sensor.type_accelerometer); } protected void onresume() { } super.onresume(); msensormanager.registerlistener(this, maccelerometer, SensorManager.SENSOR_DELAY_NORMAL); protected void onpause() { super.onpause(); } msensormanager.unregisterlistener(this); public void onaccuracychanged(sensor sensor, int accuracy) {} public void onsensorchanged(sensorevent event) { Log.v("SensorActivity", event.tostring()); } } Principles of Interaction // 2014S // Slide < 25 > Check the log in Eclipse (connect in DDMS view)

SensorEvent SensorEvent (android.hardware.sensorevent) int accuracy The accuracy of this event. Sensor sensor The sensor that generated this event. long float[] values timestamp The time in nanosecond at which the event happened The length and contents of the values array depends on which sensor type is being monitored TYPE_ACCELEROMETER: All values are in SI units (m/s 2 ) values[0]: Acceleration (including Gx) on the x-axis values[1]: Acceleration (including Gy) on the y-axis values[2]: Acceleration (including Gz) on the z-axis Principles of Interaction // 2014S // Slide < 26 >

WiFi Android Connectivity Manager Class that answers queries about the state of network connectivity. It also notifies applications when network connectivity changes. Get an instance of this class by calling Context.getSystemService(Context.CONNECTIVITY_SERVICE)! The primary responsibilities of this class are to: Monitor network connections (Wi-Fi, GPRS, UMTS, etc.) Send broadcast intents when network connectivity changes Attempt to "fail over" to another network when connectivity to a network is lost Provide an API that allows applications to query the coarse-grained or fine-grained state of the available networks (à http://developer.android.com/reference/android/net/connectivitymanager.html) Android WiFi Manager This class provides the primary API for managing all aspects of Wi-Fi connectivity. Get an instance of this class by calling Context.getSystemService(Context.WIFI_SERVICE). It deals with: The list of configured networks. The list can be viewed and updated, and attributes of individual entries can be modified. The currently active Wi-Fi network, if any. Connectivity can be established or torn down, and dynamic information about the state of the network can be queried. Results of access point scans, containing enough information to make decisions about what access point to connect to. It defines the names of various Intent actions that are broadcast upon any sort of change in Wi-Fi state (à http://developer.android.com/reference/android/net/wifi/wifimanager.html) Principles of Interaction // 2014S // Slide < 27 >

Further reading For an in-depth introduction read the developer guide at: http://developer.android.com/guide/ Principles of Interaction // 2014S // Slide < 28 >

Assignment PR Team Project >> Implementation & Deployment Please be aware of the due date/time! Start first with a discussion about the research question you want to address Principles of Interaction // 2014S // Slide < 29 >