Real-Time Embedded Systems

Similar documents
Embedded Systems Programming - PA8001

UNDERSTANDING ACTIVITIES

Introduction to Android development

LECTURE NOTES OF APPLICATION ACTIVITIES

Vienos veiklos būsena. Theory

Lab 1: Getting Started With Android Programming

Overview of Activities

Computer Science E-76 Building Mobile Applications

Mobile Application Development - Android

Android Fundamentals - Part 1

Introduction To Android

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

MODULE 2: GETTING STARTED WITH ANDROID PROGRAMMING

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

Getting Started. Dr. Miguel A. Labrador Department of Computer Science & Engineering

Introduction to Android

Activities. Repo:

Android Workshop: Model View Controller ( MVC):

Android Development Tutorial. Yi Huang

EMBEDDED SYSTEMS PROGRAMMING Application Basics

Android Basics. - Bhaumik Shukla Android Application STEALTH FLASH

Android Application Development

Introduction to Android

Android Ecosystem and. Revised v4presenter. What s New

Android Activities. Akhilesh Tyagi

Applications. Marco Ronchetti Università degli Studi di Trento

Mobile Application Development

COMP4521 EMBEDDED SYSTEMS SOFTWARE

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

BCA 6. Question Bank

Mobile Programming Lecture 5. Composite Views, Activities, Intents and Filters

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

Introduction to Android

Security model. Marco Ronchetti Università degli Studi di Trento

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

University of Babylon - College of IT SW Dep. - Android Assist. Lect. Wadhah R. Baiee Activities

INTRODUCTION TO ANDROID

App Development for Android. Prabhaker Matet

Solving an Android Threading Problem

Introduction to Android Development

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

IEMS 5722 Mobile Network Programming and Distributed Server Architecture

Xin Pan. CSCI Fall

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

Android App Development

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

Android HelloWorld - Example. Tushar B. Kute,

Android Programmierung leichtgemacht. Lars Vogel

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

CS260 Intro to Java & Android 04.Android Intro

CMSC436: Fall 2013 Week 3 Lab

Figure 2.10 demonstrates the creation of a new project named Chapter2 using the wizard.

Agenda. Overview of Xamarin and Xamarin.Android Xamarin.Android fundamentals Creating a detail screen

Diving into Android. By Jeroen Tietema. Jeroen Tietema,

CSCU9YH Development with Android

Mobile Programming Lecture 1. Getting Started

ACTIVITY, FRAGMENT, NAVIGATION. Roberto Beraldi

Android framework overview Activity lifecycle and states

A Crash Course to Android Mobile Platform

Mobila applikationer och trådlösa nät, HI1033, HT2012

University of Stirling Computing Science Telecommunications Systems and Services CSCU9YH: Android Practical 1 Hello World

Fragments were added to the Android API in Honeycomb, API 11. The primary classes related to fragments are: android.app.fragment

COSC 3P97 Mobile Computing

Android Beginners Workshop

Lifecycle Callbacks and Intents

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

Activities and Fragments

Android Software Development Kit (Part I)

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

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

Agenda. The Android GUI Framework Introduction Anatomy A real word example Life cycle Findings

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

ECOM 5341 Mobile Computing(Android) Eng.Ruba A. Salamah

Have a development environment in 256 or 255 Be familiar with the application lifecycle

Android Services. Victor Matos Cleveland State University. Services

Introduction. Lecture 1. Operating Systems Practical. 5 October 2016

Manifest.xml. Activity.java

CS 528 Mobile and Ubiquitous Computing Lecture 3b: Android Activity Lifecycle and Intents Emmanuel Agu

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

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

ANDROID SYLLABUS. Advanced Android

ABSTRACT I. INTRODUCTION. E. Susmitha, M. Himabindu M.Tech Academic Assistant, IIIT Rk Valley, Rgukt, Andhra Pradesh, India

Building MyFirstApp Android Application Step by Step. Sang Shin Learn with Passion!

Android App Development. Mr. Michaud ICE Programs Georgia Institute of Technology

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

Mobile development initiation

IJRDTM Kailash ISBN No Vol.17 Issue

Android development. Outline. Android Studio. Setting up Android Studio. 1. Set up Android Studio. Tiberiu Vilcu. 2.

COLLEGE OF ENGINEERING, NASHIK-4

Android for Ubiquitous Computing Researchers. Andrew Rice University of Cambridge 17-Sep-2011

Mobile User Interfaces

States of Activities. Active Pause Stop Inactive

EMBEDDED SYSTEMS PROGRAMMING Android NDK

Android App Development

SHWETANK KUMAR GUPTA Only For Education Purpose

Mobila applikationer och trådlösa nät, HI1033, HT2013

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

Embedded Systems Programming - PA8001

ATC Android Application Development

Android Application Development. By : Shibaji Debnath

Transcription:

Real-Time Embedded Systems DT8025, Fall 2016 http://goo.gl/azfc9l Lecture 8 Masoumeh Taromirad m.taromirad@hh.se Center for Research on Embedded Systems School of Information Technology 1 / 51

Smart phones actors Google Platform: Android Language: Java Development: Eclipse Apple Platform: ios Language: Objective C Development: Xcode Microsoft Platform: Windows Phone Language: C# Development: Visual Studio We choose Android because it is more open, it is easier to distribute apps and most of you are familiar with Java and Eclipse. Java libraries are available. Swing is not available, UIs are done in a different way. 2 / 51

A paradigm shift Before Large teams of programmers involved in large pieces of software following a software engineering process. Now One (or a few) programmers developing apps that do very specific things and make use of other apps for standard things. Before Big releases, including distributing to customers or retailers. Now Just distribute online or use some app market. 3 / 51

The Platform Architecture 4 / 51

Linux kernel Device drivers Process management (process creation, memory management) Interprocess communication We will not use this directly but it is important to know that each application that is started is a Linux user! So: applications run in isolation from other apps! 5 / 51

Hardware Abstraction Layer (HAL) standard interfaces that expose device hardware capabilities to the higher-level. to access device hardware, the Android system loads the library module for that hardware component. 6 / 51

Android Runtime (ART) Every Android application runs in its own process, with its own instance of the Android Runtime (ART). ART has been written so that a device can run multiple VMs on low-memory devices efficiently. 7 / 51

Android Runtime (ART) The ART VM executes DEX files, a bytecode format which is optimized for minimal memory footprint. The ART relies on the Linux kernel for underlying functionality such as threading and low-level memory management. 8 / 51

Native C/C++ Libraries Many core Android system components and services, such as ART and HAL, are built from native code that require native libraries written in C and C++. 9 / 51

Java API Framework The entire feature-set of the Android OS is available to you through APIs written in the Java language. View System, Resource Manager, Notification Manager, Activity Manager, Content Providers,... 10 / 51

System Apps Android applications Android comes with a set of core apps for email, messaging, calendars, internet browsing, contacts, and... Apps included with the platform have no special status among the apps the user chooses to install. 11 / 51

Hello World! What could an Android hello world application be like? 12 / 51

Android 101 Download and install Android SDK (ADT Bundle) from: http://developer.android.com/sdk/ 13 / 51

Android 101 In order to run your Hello World! app: 1. connect your Android cell-phone and enable USB debug on your device, or 2. install a virtual device. 14 / 51

Hello World! 1. Create a new Android Virtual Device (AVD) 2. Create a new Android application project 3. Run and see the behavior 4. Check out the res/layout and res/values 15 / 51

What did we see? A screen: this will be reflected in the program as an Activity. UI components: in the program these are Views. 16 / 51

Applications The AndroidManifest puts together Activities Services There is no main! BroadcastReceivers ResourceProviders Intents to build an application. Layouts Drawables Values 17 / 51

Some code void onclick(view view) { try{ String address = addressfield.gettext().tostring(); address = address.replace(, + ); Intent geointent = new Intent(android.content.Intent.ACTION_VIEW, Uri.parse("geo:0,0?q=" + address)); startactivity(geointent); } catch (Exception e) } This is something a button can do when clicked! We just have to associate this function with the right button! 18 / 51

Some code void onclick(view view){ try{ String address = addressfield.gettext().tostring(); address = address.replace(, + ); Intent geointent = new Intent(android.content.Intent.ACTION_VIEW, Uri.parse("geo:0,0?q=" + address)); startactivity(geointent); } catch (Exception e) } A kind of View called an EditText can be used this way! 19 / 51

Some code void onclick(view view){ try{ String address = addressfield.gettext().tostring(); address = address.replace(, + ); Intent geointent = new Intent(android.content.Intent.ACTION_VIEW, Uri.parse("geo:0,0?q=" + address)); startactivity(geointent); } catch (Exception e) } An Intent has an action and some data. It is something the program can ask the OS to deliver to some app that can do this! 20 / 51

Some code void onclick(view view){ try{ String address = addressfield.gettext().tostring(); address = address.replace(, + ); Intent geointent = new Intent(android.content.Intent.ACTION_VIEW, Uri.parse("geo:0,0?q=" + address)); startactivity(geointent) ; } catch (Exception e) } This is where the program asks the OS to deliver the Intent. 21 / 51

Activities Each activity has a window to display its UI. It typically fills the screen. An application usually consists of multiple activities that are loosely bound to each other. Typically, one activity in an application is specified as the main activity, which is presented to the user when launching the application for the first time. 22 / 51

Activities Activities can start each other, as a result: Started activity pushed on top of the stack, taking user focus, Starting activity stopped and remains in the stack. The Skype app Main Contacts Profile Latest 23 / 51

Life cycle 24 / 51

An application with one activity public class Quiter extends Activity{ public void oncreate(bundle savedinstancestate){ super.oncreate(savedinstancestate); setcontentview(r.layout.main); Button q = (Button)findViewById(R.id.quitButton); } } q.setonclicklistener( new Button.OnClickListener(){ public void onclick(view view){ finish(); }}); 25 / 51

The AndroidManifest (generated automatically!) <?xml version="1.0" encoding="utf-8"?> <manifest xmlns:android="...> <application android:label="@string/app_name" android:icon="@drawable/icon"> <activity android:name="quiter" 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> 26 / 51

The resources: main layout <?xml version="1.0" encoding="utf-8"?> <LinearLayout xmlns:android="... android:orientation="vertical" android:layout_width="fill_parent" android:layout_height="fill_parent" > <Button android:id="@+id/quitbutton" android:layout_width="fill_parent" android:layout_height="fill_parent" android:text="@string/quittext" /> </LinearLayout> 27 / 51

The resources: string values <?xml version="1.0" encoding="utf-8"?> <resources> <string name="app_name">quitter</string> <string name="quittext">stop this!</string> </resources> 28 / 51

The resources: drawables res/drawable-hdpi/icon.png 29 / 51

Exploring the life cycle We implement all the methods that are called by the system: public class Quitter extends Activity{ public void oncreate(bundle savedinstancestate){...} public void onpause(){...} public void onstop(){...} public void ondestroy(){...} public void onresume(){...} public void onstart(){...} public void onrestart(){...} } Don t forget to call super.onsomething before doing other stuff when you override these methods! 30 / 51

Exploring the life cycle We can use android.util.log to produce debugging messages in the development terminal. public void onresume(){ super.onresume(); Log.d("quitter", "onresume"); } public void onstart(){ super.onstart(); Log.d("quitter", "onstart"); } public void onrestart(){ super.onrestart(); Log.d("quitter", "onrestart"); } 31 / 51