Services. Background operating component without a visual interface Running in the background indefinitely

Size: px
Start display at page:

Download "Services. Background operating component without a visual interface Running in the background indefinitely"

Transcription

1 Services Background operating component without a visual interface Running in the background indefinitely Differently from Activity, Service in Android runs in background, they don t have an interface and have a life-cycle very different from Activities. Using Service we can implement some background operation Examples Network Downloads Playing Music in the background while the user is in a different application TCP/UDP Server You can bind to a an existing service and control its operation fetch data over the network without blocking user interaction with an activity

2 Service state forms A service is an application component that can perform long-running operations in the background and does not provide a user interface. Another application component can start a service and it will continue to run in the background even if the user switches to another application. Additionally, a component can bind to a service to interact with it and even perform inter-process communication (IPC). A service can essentially take two forms: Started A service is "started" when an application component (such as an activity) starts it by calling startservice(). Once started, a service can run in the foregraound/background indefinitely, even if the component that started it is destroyed. Bound A service is "bound" when an application component binds to it by calling bindservice(). A bound service offers a client-server interface that allows components to interact with the service, send requests, get results, and even do so across processes with inter-process communication (IPC).

3 Bound Service Local Binding Remote Binding Android Interface Definition Language

4 Life of Cycle context.startservice() ->oncreate()->onstartcommand()->service running--->context.stopservice() ->ondestroy() context.bindservice() ->oncreate()->onbind() running--->onunbind() ->ondestroy() ->Service To create a service, you must create a subclass of Service(or one of its existing subclass). onstartcommand(): The system calls this method when another component, such as an activity, requests that the service be started, by calling startservice(). onbind(): The system calls this method when another component wants to bind with the service (such as to perform IPC), by calling bindservice(). oncreate(): The system calls this method when the service is first created, to perform one-time setup procedures ondestroy(): The system calls this method when the service is no longer used and is being destroyed.

5 Services has different life cycle from Activity. Start Service life cycle by startservice() or bindservice()

6 Service classes Traditionally, there are two classes you can extend to create a started service: Service the service uses your application's main thread by default, which can slow the performance of any activity that your application is running IntentService This is a subclass of Service that uses a worker thread to handle all of the start requests, one at a time.

7 Difference between bound and unbound service in Android Android Bound Service and Unbound Service run in Background Android Services is used to do any background task in current activity. Bound Service: Service which call indefinitely in between activity. An Android component may bind itself to a Service using bindservice(). A bound service would run as long as the other application components are bound to it. As soon as they unbind, the service destroys itself. Unbound Service: Service which call at the life span of calling activity. In this case, an application component starts the service, and it would continue to run in the background, even if the original component that initiated it is destroyed. For instance, when started, a service would continue to play music in the background indefinitely.

8 The difference between them If a component starts the service by calling startservice() (which results in a call to onstartcommand()), then the service remains running until it stops itself with stopself() or another component stops it by calling stopservice(). If a component calls bindservice() to create the service (and onstartcommand is not called), then the service runs only as long as the component is bound to it. Once the service is unbound from all clients, the system destroys it.

9 Android Activity can be started, stopped, destroyed if the system resources become too low and maybe can be recreated, a Service are designed to have a longer life. A Service in Android can be started from an Activity, from a Broadcast receiver and other services too. We have to notice that using Service we don t create automatically new threads, so if we implement a simple logic inside our Service, that doesn t require long time processing we don t need to run it a separate thread, but if we have to implement complex logic, with long time processing, we have to take care of creating a new thread, otherwise the service runs on the main thread and it could cause (Application Not Responding) ANR problem.

10 Service applications *Implement multi-task A typical example is an app that required to download data from a remote server, in this case we can have Activity that interacts with a user and starts a service that accomplishes the work in background while the user can use the app and maybe when the service finishes sends a message to the user. *Enable Inter-Process-Communication (IPC) In this case, we want to share some common functions so that different app can re-use them. For example, we can suppose we have a service that sends an and we want to share this service among several apps so that we don t have to rewrite the same code. In this case we can use IPC so that the service exposes a remote interface that can be called by other app

11 Service basics To create a Service we have to extend Service class: public class TestService extends Service public IBinder onbind(intent arg0) { return null; } } In this case, only implement one method called onbind using local service, so this method should return null.

12 Service lifecycle and override its callback methods public class TestService extends Service public void oncreate() { super.oncreate(); } public void ondestroy() { super.ondestroy(); public int onstartcommand(intent intent, int flags, int startid) { return super.onstartcommand(intent, flags, startid); public IBinder onbind(intent arg0) { return null; }

13 oncreate() and OnStartCommand() oncreate is called only one time when the Service has to created. If the Service is already running, this method won t be called. We don t call it directly but OS calls it. oncreate method is called we start the service, if we click again, the OS doesn t call oncreate method. When we click on stop button the OS destroy the service. OnStartCommand is is called when we required to start the Service. In this method we have the Intent passed at time we run the Service, in this way we can exchange some information with the Service. In this method, we implement our logic that can be execute directly inside this method if it isn t time expensive otherwise we can create a thread. As you can see this method requires we return an Integer as result. This integer represents how the Service should be handled by the OS: START_STICKY : Using this return value, if the OS kills our Service it will recreate it but the Intent that was sent to the Service isn t redelivered. In this way the Service is always running START_NOT_STICKY: If the SO kills the Service it won t recreate it until the client calls explicitly invoke onstartcommand START_REDELIVER_INTENT: It is similar to the START_STICKY and in this case the Intent will be redelivered to the service.

14 Service Behaviour

15 Service declaration in Manifest.xml declare service in the Manifest.xml so that we can use it: <service android:name=".testservice" android:enabled="true"/> Start and Stop Service As we know a Service has to be started and eventually stopped so that it can accomplish its task. We can suppose to start it from an activity and we could pass to the service some information using Intent. We can suppose that our Activity has two buttons one to start and one to stop the Service:

16 btnstart.setonclicklistener(new View.OnClickListener() public void onclick(view v) { Intent i = new Intent(MainActivity.this, TestService.class); i.putextra("name", "SurvivingwithAndroid"); MainActivity.this.startService(i); } }); btnstop.setonclicklistener(new View.OnClickListener() public void onclick(view v) { Intent i = new Intent(MainActivity.this, TestService.class); MainActivity.this.stopService(i); } }); In the above code, we create an Intent passing the class name that handles our Service, moreover we set some parameters like name and then we start the Service. In the same way, we stop the service later.

17 Clicking on Start button we get in the Log:

18 Starting service automatically Many times we want to start our service automatically, for example at boot time. We know to start a Service we need a component to start it. How can we do it? Well, we could use a Broadcast receiver that starts our service. If for example we want to start it at the smartphone boot time, we create first a Broadcast receiver that listens to this event and then it starts the service. public class BootBroadcast extends BroadcastReceiver public void onreceive(context ctx, Intent intent) { ctx.startservice(new Intent(ctx, TestService.class)); } } and in the Manifest.xml <receiver android:name=".bootbroadcast"> <intent-filter > <action android:name="android.intent.action.boot_completed"/> </intent-filter> </receiver>

19 Bound Services Summary Component can bind to both started, un-started service Any number of components can bind to a service A bound service usually cannot be destroyed (exception resource crunch) If stop service had been called (while service was bound), it will be stopped automatically when all the components from the service are unbound Components which can bind to a service are: Activity, Service, and Content Provider.

20

MOBILE APPLICATION DEVELOPMENT LECTURE 10 SERVICES IMRAN IHSAN ASSISTANT PROFESSOR

MOBILE APPLICATION DEVELOPMENT LECTURE 10 SERVICES IMRAN IHSAN ASSISTANT PROFESSOR MOBILE APPLICATION DEVELOPMENT LECTURE 10 SERVICES IMRAN IHSAN ASSISTANT PROFESSOR WWW.IMRANIHSAN.COM Android Component A Service is an application component that runs in the background, not interacting

More information

CS378 -Mobile Computing. Services and Broadcast Receivers

CS378 -Mobile Computing. Services and Broadcast Receivers CS378 -Mobile Computing Services and Broadcast Receivers Services One of the four primary application components: activities content providers services broadcast receivers 2 Services Application component

More information

EMBEDDED SYSTEMS PROGRAMMING Android Services

EMBEDDED SYSTEMS PROGRAMMING Android Services EMBEDDED SYSTEMS PROGRAMMING 2016-17 Android Services APP COMPONENTS Activity: a single screen with a user interface Broadcast receiver: responds to system-wide broadcast events. No user interface Service:

More information

Android Fundamentals - Part 1

Android Fundamentals - Part 1 Android Fundamentals - Part 1 Alexander Nelson September 1, 2017 University of Arkansas - Department of Computer Science and Computer Engineering Reminders Projects Project 1 due Wednesday, September 13th

More information

Mobile Programming Practice Background processing AsynTask Service Broadcast receiver Lab #5

Mobile Programming Practice Background processing AsynTask Service Broadcast receiver Lab #5 1 Mobile Programming Practice Background processing AsynTask Service Broadcast receiver Lab #5 Prof. Hwansoo Han T.A. Sung-in Hong T.A. Minseop Jeong 2 Background processing Every Android app has a main

More information

Services are software components designed specifically to perform long background operations.

Services are software components designed specifically to perform long background operations. SERVICES Service Services are software components designed specifically to perform long background operations. such as downloading a file over an internet connection or streaming music to the user, but

More information

ANDROID SERVICES, BROADCAST RECEIVER, APPLICATION RESOURCES AND PROCESS

ANDROID SERVICES, BROADCAST RECEIVER, APPLICATION RESOURCES AND PROCESS ANDROID SERVICES, BROADCAST RECEIVER, APPLICATION RESOURCES AND PROCESS 1 Instructor: Mazhar Hussain Services A Service is an application component that can perform long-running operations in the background

More information

Services. Marco Ronchetti Università degli Studi di Trento

Services. Marco Ronchetti Università degli Studi di Trento 1 Services Marco Ronchetti Università degli Studi di Trento Service An application component that can perform longrunning operations in the background and does not provide a user interface. So, what s

More information

Android. Broadcasts Services Notifications

Android. Broadcasts Services Notifications Android Broadcasts Services Notifications Broadcast receivers Application components that can receive intents from other applications Broadcast receivers must be declared in the manifest They have an associated

More information

Software Practice 3 Today s lecture Today s Task

Software Practice 3 Today s lecture Today s Task 1 Software Practice 3 Today s lecture Today s Task Prof. Hwansoo Han T.A. Jeonghwan Park 43 2 MULTITHREAD IN ANDROID 3 Activity and Service before midterm after midterm 4 Java Thread Thread is an execution

More information

Services. Marco Ronchetti Università degli Studi di Trento

Services. Marco Ronchetti Università degli Studi di Trento 1 Services Marco Ronchetti Università degli Studi di Trento Service An application component that can perform longrunning operations in the background and does not provide a user interface. So, what s

More information

Services. service: A background task used by an app.

Services. service: A background task used by an app. CS 193A Services This document is copyright (C) Marty Stepp and Stanford Computer Science. Licensed under Creative Commons Attribution 2.5 License. All rights reserved. Services service: A background task

More information

Android Services & Local IPC: The Command Processor Pattern (Part 1)

Android Services & Local IPC: The Command Processor Pattern (Part 1) : The Command Processor Pattern (Part 1) d.schmidt@vanderbilt.edu www.dre.vanderbilt.edu/~schmidt Professor of Computer Science Institute for Software Integrated Systems Vanderbilt University Nashville,

More information

Android Services & Local IPC: Overview of Programming Bound Services

Android Services & Local IPC: Overview of Programming Bound Services : Overview of Programming Bound Services d.schmidt@vanderbilt.edu www.dre.vanderbilt.edu/~schmidt Professor of Computer Science Institute for Software Integrated Systems Vanderbilt University Nashville,

More information

Android Services. Victor Matos Cleveland State University. Services

Android Services. Victor Matos Cleveland State University. Services 22 Android Victor Matos Cleveland State University Notes are based on: Android Developers http://developer.android.com/index.html 22. Android Android A Service is an application component that runs in

More information

Broadcast receivers. Marco Ronchetti Università degli Studi di Trento

Broadcast receivers. Marco Ronchetti Università degli Studi di Trento 1 Broadcast receivers Marco Ronchetti Università degli Studi di Trento Bradcast receiver a component that responds to system-wide broadcast announcements. Many broadcasts originate from the system for

More information

Services & Interprocess Communication (IPC) CS 282 Principles of Operating Systems II Systems Programming for Android

Services & Interprocess Communication (IPC) CS 282 Principles of Operating Systems II Systems Programming for Android Services & Interprocess Communication (IPC) CS 282 Principles of Operating Systems II Systems Programming for Android A Service is an application component that can perform longrunning operations in the

More information

Services Broadcast Receivers Permissions

Services Broadcast Receivers Permissions Services Broadcast Receivers Permissions Runs in the background Extends Service Java class Not necessarily connected to the user s visual interface Music player working in foreground User wants read email

More information

App Development for Smart Devices. Lec #7: Windows Azure

App Development for Smart Devices. Lec #7: Windows Azure App Development for Smart Devices CS 495/595 - Fall 2011 Lec #7: Windows Azure Tamer Nadeem Dept. of Computer Science Objective Working in Background AsyncTask Cloud Computing Windows Azure Two Presentation

More information

IPN-ESCOM Application Development for Mobile Devices. Extraordinary. A Web service, invoking the SOAP protocol, in an Android application.

IPN-ESCOM Application Development for Mobile Devices. Extraordinary. A Web service, invoking the SOAP protocol, in an Android application. Learning Unit Exam Project IPN-ESCOM Application Development for Mobile Devices. Extraordinary. A Web service, invoking the SOAP protocol, in an Android application. The delivery of this project is essential

More information

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

Understand applications and their components. activity service broadcast receiver content provider intent AndroidManifest.xml Understand applications and their components activity service broadcast receiver content provider intent AndroidManifest.xml Android Application Written in Java (it s possible to write native code) Good

More information

Mobile Computing. Introduction to Android

Mobile Computing. Introduction to Android Mobile Computing Introduction to Android Mobile Computing 2011/2012 What is Android? Open-source software stack for mobile devices OS, middleware and key applications Based upon a modified version of the

More information

Mobile Application Development Android

Mobile Application Development Android Mobile Application Development Android Lecture 3 MTAT.03.262 Satish Srirama satish.srirama@ut.ee Android Lecture 2 - recap Views and Layouts Events Basic application components Activities Intents 9/15/2014

More information

Mobile Application Development Android

Mobile Application Development Android Mobile Application Development Android Lecture 3 MTAT.03.262 Satish Srirama satish.srirama@ut.ee Android Lecture 2 -recap Views and Layouts Events Basic application components Activities Intents BroadcastReceivers

More information

Android permissions Defining and using permissions Component permissions and related APIs

Android permissions Defining and using permissions Component permissions and related APIs Android permissions Defining and using permissions Component permissions and related APIs Permissions protects resources and data For instance, they limit access to: User information e.g, Contacts Cost-sensitive

More information

Programming with Android: Notifications, Threads, Services. Luca Bedogni. Dipartimento di Scienze dell Informazione Università di Bologna

Programming with Android: Notifications, Threads, Services. Luca Bedogni. Dipartimento di Scienze dell Informazione Università di Bologna Programming with Android: Notifications, Threads, Dipartimento di Scienze dell Informazione Università di Bologna Outline Notification : Status Bar Notifications Notification : Toast Notifications Thread

More information

Android System Development Day-4. Team Emertxe

Android System Development Day-4. Team Emertxe Android System Development Day-4 Team Emertxe Android System Service Table of Content Introduction to service Inter Process Communication (IPC) Adding Custom Service Writing Custom HAL Compiling SDK Testing

More information

App Development for Android. Prabhaker Matet

App Development for Android. Prabhaker Matet App Development for Android Prabhaker Matet Development Tools (Android) Java Java is the same. But, not all libs are included. Unused: Swing, AWT, SWT, lcdui Android Studio (includes Intellij IDEA) Android

More information

Outline. Admin. Example: TipCalc. Android: Event Handler Blocking, Android Inter-Thread, Process Communications. Recap: Android UI App Basic Concepts

Outline. Admin. Example: TipCalc. Android: Event Handler Blocking, Android Inter-Thread, Process Communications. Recap: Android UI App Basic Concepts Outline Android: Event Handler Blocking, Android Inter-Thread, Process Communications 10/11/2012 Admin Android Basic concepts Activity, View, External Resources, Listener Inter-thread communications Handler,

More information

Android Service. Lecture 19

Android Service. Lecture 19 Android Service Lecture 19 Services Service: A background task used by an app. Example: Google Play Music plays the music using a service Example: Web browser runs a downloader service to retrieve a file

More information

Implementing a Download Background Service

Implementing a Download Background Service 1 Implementing a Download Background Service Android Services Stefan Tramm Patrick Bönzli Android Experience Day, FHNW 2008-12-03 2 Agenda Part I: Business Part the application some screenshots Part II:

More information

Android Architecture and Binder. Dhinakaran Pandiyan Saketh Paranjape

Android Architecture and Binder. Dhinakaran Pandiyan Saketh Paranjape Android Architecture and Binder Dhinakaran Pandiyan Saketh Paranjape Android Software stack Anatomy of an Android application Activity UI component typically corresponding of one screen Service Background

More information

Embedded Systems Programming - PA8001

Embedded Systems Programming - PA8001 Embedded Systems Programming - PA8001 http://goo.gl/ydeczu Lecture 9 Mohammad Mousavi m.r.mousavi@hh.se Center for Research on Embedded Systems School of Information Science, Computer and Electrical Engineering

More information

Minds-on: Android. Session 2

Minds-on: Android. Session 2 Minds-on: Android Session 2 Paulo Baltarejo Sousa Instituto Superior de Engenharia do Porto 2016 Outline Activities UI Events Intents Practice Assignment 1 / 33 2 / 33 Activities Activity An activity provides

More information

1. GOALS and MOTIVATION

1. GOALS and MOTIVATION AppSeer: Discovering Interface Defects among Android Components Vincenzo Chiaramida, Francesco Pinci, Ugo Buy and Rigel Gjomemo University of Illinois at Chicago 4 September 2018 Slides by: Vincenzo Chiaramida

More information

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

ANDROID APPS DEVELOPMENT FOR MOBILE AND TABLET DEVICE (LEVEL II) ANDROID APPS DEVELOPMENT FOR MOBILE AND TABLET DEVICE (LEVEL II) Lecture 6: Notification and Web Services Notification A notification is a user interface element that you display outside your app's normal

More information

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

CS378 - Mobile Computing. Anatomy of an Android App and the App Lifecycle CS378 - Mobile Computing Anatomy of an Android App and the App Lifecycle Application Components five primary components different purposes and different lifecycles Activity single screen with a user interface,

More information

Application Fundamentals

Application Fundamentals Application Fundamentals CS 2046 Mobile Application Development Fall 2010 Announcements CMS is up If you did not get an email regarding this, see me after class or send me an email. Still working on room

More information

Summarizing Control Flow of Callbacks for Android API Methods

Summarizing Control Flow of Callbacks for Android API Methods Summarizing Control Flow of Callbacks for Android API Methods Danilo Dominguez Perez and Wei Le Iowa State University {danilo0, weile}@iastate.edu ABSTRACT Ensuring the reliability and security of Android

More information

Theme 2 Program Design. MVC and MVP

Theme 2 Program Design. MVC and MVP Theme 2 Program Design MVC and MVP 1 References Next to the books used for this course, this part is based on the following references: Interactive Application Architecture Patterns, http:// aspiringcraftsman.com/2007/08/25/interactiveapplication-architecture/

More information

Xin Pan. CSCI Fall

Xin Pan. CSCI Fall Xin Pan CSCI5448 2011 Fall Outline Introduction of Android System Four primary application components AndroidManifest.xml Introduction of Android Sensor Framework Package Interface Classes Examples of

More information

Mobile Application Development Android

Mobile Application Development Android Mobile Application Development Android Lecture 3 MTAT.03.262 Satish Srirama satish.srirama@ut.ee Android Lecture 2 - recap Views and Layouts Events Basic application components Activities Intents 9/22/2017

More information

CS 370 Android Basics D R. M I C H A E L J. R E A L E F A L L

CS 370 Android Basics D R. M I C H A E L J. R E A L E F A L L CS 370 Android Basics D R. M I C H A E L J. R E A L E F A L L 2 0 1 5 Activity Basics Manifest File AndroidManifest.xml Central configuration of Android application Defines: Name of application Icon for

More information

Android Services & Local IPC: The Activator Pattern (Part 2)

Android Services & Local IPC: The Activator Pattern (Part 2) : The Activator Pattern (Part 2) d.schmidt@vanderbilt.edu www.dre.vanderbilt.edu/~schmidt Professor of Computer Science Institute for Software Integrated Systems Vanderbilt University Nashville, Tennessee,

More information

Lecture 2 Android SDK

Lecture 2 Android SDK Lecture 2 Android SDK This work is licensed under the Creative Commons Attribution 4.0 International License. To view a copy of this license, visit http://creativecommons.org/licenses/by/4.0/ or send a

More information

Mobile and Ubiquitous Computing: Android Programming (part 3)

Mobile and Ubiquitous Computing: Android Programming (part 3) Mobile and Ubiquitous Computing: Android Programming (part 3) Master studies, Winter 2015/2016 Dr Veljko Pejović Veljko.Pejovic@fri.uni-lj.si Based on Programming Handheld Systems, Adam Porter, University

More information

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

Produced by. Mobile Application Development. David Drohan Department of Computing & Mathematics Waterford Institute of Technology Mobile Application Development Produced by David Drohan (ddrohan@wit.ie) Department of Computing & Mathematics Waterford Institute of Technology http://www.wit.ie Android Anatomy Android Anatomy 2! Agenda

More information

CMSC436: Fall 2013 Week 3 Lab

CMSC436: Fall 2013 Week 3 Lab CMSC436: Fall 2013 Week 3 Lab Objectives: Familiarize yourself with the Activity class, the Activity lifecycle, and the Android reconfiguration process. Create and monitor a simple application to observe

More information

Termite WiFi Direct API

Termite WiFi Direct API Termite WiFi Direct API Developers Guide 2014/15 Nuno Santos 1. Objectives This document provides a brief description of the Termite WiFi Direct API. 2. Termite API Guide In order for an application to

More information

Lab 5 Periodic Task Scheduling

Lab 5 Periodic Task Scheduling Lab 5 Periodic Task Scheduling Scheduling a periodic task in Android is difficult as it goes against the philosophy of keeping an application active only while the user is interacting with it. You are

More information

Leak Canary Intro Jennifer McGee

Leak Canary Intro Jennifer McGee Leak Canary Intro Jennifer McGee 1 Leak Canary What is Leak Canary? Open source library written by Square s Pierre-Yves (PY) Ricau Library which attempts to automatically detect and report memory leaks

More information

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

ANDROID APPS DEVELOPMENT FOR MOBILE AND TABLET DEVICE (LEVEL I) ANDROID APPS DEVELOPMENT FOR MOBILE AND TABLET DEVICE (LEVEL I) Lecture 3: Android Life Cycle and Permission Entire Lifetime An activity begins its lifecycle when entering the oncreate() state If not interrupted

More information

Activities. https://developer.android.com/guide/components/activities.html Repo: https://github.com/karlmorris/basicactivities

Activities. https://developer.android.com/guide/components/activities.html Repo: https://github.com/karlmorris/basicactivities Activities https://developer.android.com/guide/components/activities.html Repo: https://github.com/karlmorris/basicactivities Overview What is an Activity Starting and stopping activities The Back Stack

More information

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

ANDROID APPS DEVELOPMENT FOR MOBILE AND TABLET DEVICE (LEVEL I) ANDROID APPS DEVELOPMENT FOR MOBILE AND TABLET DEVICE (LEVEL I) Lecture 3: Android Life Cycle and Permission Android Lifecycle An activity begins its lifecycle when entering the oncreate() state If not

More information

An Overview of the Android Programming

An Overview of the Android Programming ID2212 Network Programming with Java Lecture 14 An Overview of the Android Programming Hooman Peiro Sajjad KTH/ICT/SCS HT 2016 References http://developer.android.com/training/index.html Developing Android

More information

ACTIVITY, FRAGMENT, NAVIGATION. Roberto Beraldi

ACTIVITY, FRAGMENT, NAVIGATION. Roberto Beraldi ACTIVITY, FRAGMENT, NAVIGATION Roberto Beraldi Introduction An application is composed of at least one Activity GUI It is a software component that stays behind a GUI (screen) Activity It runs inside the

More information

Lifecycle-Aware Components Live Data ViewModel Room Library

Lifecycle-Aware Components Live Data ViewModel Room Library Lifecycle-Aware Components Live Data ViewModel Room Library Multiple entry points launched individually Components started in many different orders Android kills components on reconfiguration / low memory

More information

Understanding Intents and Intent Filters

Understanding Intents and Intent Filters 255 Chapter 11 Understanding Intents and Intent Filters This chapter will delve into intents, which are messaging objects that carry communications between the major components of your application your

More information

Import the code in the top level sdl_android folder as a module in Android Studio:

Import the code in the top level sdl_android folder as a module in Android Studio: Guides Android Documentation Document current as of 12/22/2017 10:31 AM. Installation SOURCE Download the latest release from GitHub Extract the source code from the archive Import the code in the top

More information

EMBEDDED SYSTEMS PROGRAMMING Application Basics

EMBEDDED SYSTEMS PROGRAMMING Application Basics EMBEDDED SYSTEMS PROGRAMMING 2015-16 Application Basics APPLICATIONS Application components (e.g., UI elements) are objects instantiated from the platform s frameworks Applications are event driven ( there

More information

Mobile Platforms and Middleware

Mobile Platforms and Middleware Department of Computer Science Institute for System Architecture, Chair for Computer Networks Mobile Platforms and Middleware Mobile Communication and Mobile Computing Prof. Dr. Alexander Schill http://www.rn.inf.tu-dresden.de

More information

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

Getting started: Installing IDE and SDK. Marco Ronchetti Università degli Studi di Trento Getting started: Installing IDE and SDK Marco Ronchetti Università degli Studi di Trento Alternative: Android Studio http://developer.android.com/develop/index.html 2 Tools behind the scenes dx allows

More information

LECTURE 12 BROADCAST RECEIVERS

LECTURE 12 BROADCAST RECEIVERS MOBILE APPLICATION DEVELOPMENT LECTURE 12 BROADCAST RECEIVERS IMRAN IHSAN ASSISTANT PROFESSOR WWW.IMRANIHSAN.COM Application Building Blocks Android Component Activity UI Component Typically Corresponding

More information

Android About.me/DavidCorrado Mobile Meetup Organizer

Android About.me/DavidCorrado Mobile Meetup Organizer Android Tips/Tricks @DavidCorrado About.me/DavidCorrado Mobile Meetup Organizer IDE Don t Use Eclipse Use either Android Studio/IntelliJ They are basically the same thing. They are both built off of IntelliJ

More information

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

Android. Mobile operating system developed by Google A complete stack. Based on the Linux kernel Open source under the Apache 2 license Android Android Mobile operating system developed by Google A complete stack OS, framework A rich set of applications Email, calendar, browser, maps, text messaging, contacts, camera, dialer, music player,

More information

Produced by. Design Patterns. MSc in Computer Science. Eamonn de Leastar

Produced by. Design Patterns. MSc in Computer Science. Eamonn de Leastar Design Patterns MSc in Computer Science Produced by Eamonn de Leastar (edeleastar@wit.ie)! Department of Computing, Maths & Physics Waterford Institute of Technology http://www.wit.ie http://elearning.wit.ie

More information

Security model. Marco Ronchetti Università degli Studi di Trento

Security model. Marco Ronchetti Università degli Studi di Trento Security model Marco Ronchetti Università degli Studi di Trento Security model 2 Android OS is a multi-user Linux in which each application is a different user. By default, the system assigns each application

More information

INTRODUCTION TO ANDROID

INTRODUCTION TO ANDROID INTRODUCTION TO ANDROID 1 Niv Voskoboynik Ben-Gurion University Electrical and Computer Engineering Advanced computer lab 2015 2 Contents Introduction Prior learning Download and install Thread Android

More information

Programming Android UI. J. Serrat Software Design December 2017

Programming Android UI. J. Serrat Software Design December 2017 Programming Android UI J. Serrat Software Design December 2017 Preliminaries : Goals Introduce basic programming Android concepts Examine code for some simple examples Limited to those relevant for the

More information

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

CS 528 Mobile and Ubiquitous Computing Lecture 3b: Android Activity Lifecycle and Intents Emmanuel Agu CS 528 Mobile and Ubiquitous Computing Lecture 3b: Android Activity Lifecycle and Intents Emmanuel Agu Android Activity LifeCycle Starting Activities Android applications don't start with a call to main(string[])

More information

Overview of Activities

Overview of Activities d.schmidt@vanderbilt.edu www.dre.vanderbilt.edu/~schmidt Institute for Software Integrated Systems Vanderbilt University Nashville, Tennessee, USA CS 282 Principles of Operating Systems II Systems Programming

More information

Introduction to Android

Introduction to Android Introduction to Android Ambient intelligence Teodoro Montanaro Politecnico di Torino, 2016/2017 Disclaimer This is only a fast introduction: It is not complete (only scrapes the surface) Only superficial

More information

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

App Development for Smart Devices. Lec #4: Services and Broadcast Receivers App Development for Smart Devices CS 495/595 - Fall 2012 Lec #4: Services and Broadcast Receivers Tamer Nadeem Dept. of Computer Science Objective Working in Background Services AsyncTask Student Presentations

More information

Ariadnima - Android Component Flow Reconstruction and Visualization

Ariadnima - Android Component Flow Reconstruction and Visualization 2017 IEEE 31st International Conference on Advanced Information Networking and Applications Ariadnima - Android Component Flow Reconstruction and Visualization Dennis Titze, Konrad Weiss, Julian Schütte

More information

Mobile and Ubiquitous Computing: Android Programming (part 4)

Mobile and Ubiquitous Computing: Android Programming (part 4) Mobile and Ubiquitous Computing: Android Programming (part 4) Master studies, Winter 2015/2016 Dr Veljko Pejović Veljko.Pejovic@fri.uni-lj.si Examples from: Mobile and Ubiquitous Computing Jo Vermeulen,

More information

Notifications and Services. Landon Cox March 28, 2017

Notifications and Services. Landon Cox March 28, 2017 Notifications and Services Landon Cox March 28, 2017 Networking so far Volley (retrieve quiz stored at URL) User starts app Check with server for new quiz Say you re building a messaging app How else might

More information

OFFLINE MODE OF ANDROID

OFFLINE MODE OF ANDROID OFFLINE MODE OF ANDROID APPS @Ajit5ingh ABOUT ME new Presenter( Ajit Singh, github.com/ajitsing, www.singhajit.com, @Ajit5ingh ) AGENDA Why offline mode? What it takes to build an offline mode Architecture

More information

Introduction to Android

Introduction to Android Introduction to Android http://myphonedeals.co.uk/blog/33-the-smartphone-os-complete-comparison-chart www.techradar.com/news/phone-and-communications/mobile-phones/ios7-vs-android-jelly-bean-vs-windows-phone-8-vs-bb10-1159893

More information

Android Activities. Akhilesh Tyagi

Android Activities. Akhilesh Tyagi Android Activities Akhilesh Tyagi Apps, memory, and storage storage: Your device has apps and files installed andstoredonitsinternaldisk,sdcard,etc. Settings Storage memory: Some subset of apps might be

More information

Understanding Application

Understanding Application Introduction to Android Application Development, Android Essentials, Fifth Edition Chapter 4 Understanding Application Components Chapter 4 Overview Master important terminology Learn what the application

More information

Table of Content. CLOUDCHERRY Android SDK Manual

Table of Content. CLOUDCHERRY Android SDK Manual Table of Content 1. Introduction: cloudcherry-android-sdk 2 2. Capabilities 2 3. Setup 2 4. How to create static token 3 5. Initialize SDK 5 6. How to trigger the SDK? 5 7. How to setup custom legends

More information

Extended Atomicity Checking with Blame Assignment for Android Applications

Extended Atomicity Checking with Blame Assignment for Android Applications Extended Atomicity Checking with Blame Assignment for Android Applications A PROJECT REPORT SUBMITTED IN PARTIAL FULFILMENT OF THE REQUIREMENTS FOR THE DEGREE OF Master of Engineering IN COMPUTER SCIENCE

More information

Mobile Application Development Android

Mobile Application Development Android Mobile Application Development Android Lecture 2 MTAT.03.262 Satish Srirama satish.srirama@ut.ee Android Lecture 1 -recap What is Android How to develop Android applications Run & debug the applications

More information

Upcoming Assignments Quiz Friday? Lab 5 due today Alpha Version due Friday, February 26

Upcoming Assignments Quiz Friday? Lab 5 due today Alpha Version due Friday, February 26 Upcoming Assignments Quiz Friday? Lab 5 due today Alpha Version due Friday, February 26 Inject one subtle defect (fault seeding) To be reviewed by a few class members Usability study by CPE 484 students

More information

CS 4518 Mobile and Ubiquitous Computing Lecture 5: Rotating Device, Saving Data, Intents and Fragments Emmanuel Agu

CS 4518 Mobile and Ubiquitous Computing Lecture 5: Rotating Device, Saving Data, Intents and Fragments Emmanuel Agu CS 4518 Mobile and Ubiquitous Computing Lecture 5: Rotating Device, Saving Data, Intents and Fragments Emmanuel Agu Administrivia Moved back deadlines for projects 2, 3 and final project See updated schedule

More information

Online Learning Application

Online Learning Application Online Learning Application Objective: It s a known fact that the Average screen sizes of our phones is increasing, thereby encouraging many to read and learn on the move. Keeping this trend in mind, you

More information

Multiple Activities. Many apps have multiple activities

Multiple Activities. Many apps have multiple activities Intents Lecture 7 Multiple Activities Many apps have multiple activities An activity A can launch another activity B in response to an event The activity A can pass data to B The second activity B can

More information

Understanding and Detecting Wake Lock Misuses for Android Applications

Understanding and Detecting Wake Lock Misuses for Android Applications Understanding and Detecting Wake Lock Misuses for Android Applications Artifact Evaluated by FSE 2016 Yepang Liu, Chang Xu, Shing-Chi Cheung, and Valerio Terragni Code Analysis, Testing and Learning Research

More information

Permissions. Lecture 18

Permissions. Lecture 18 Permissions Lecture 18 Topics related Android permissions Defining & using applica:on permissions Component permissions Permissions Android protects resources & data with permissions Example: who has the

More information

Project CODENAME Documentation

Project CODENAME Documentation Project CODENAME Documentation Release 1.0.0 Alan Zhu, Joshua Morin-Baxter Jan 06, 2018 Contents: 1 Setup, Step-by-step 1 1.1 Android App............................................... 1 1.2 Decoder..................................................

More information

MPACT LOCATION & ANALYTICS

MPACT LOCATION & ANALYTICS MPACT LOCATION & ANALYTICS Client Software Development Kit VERSION 2.0.0 MN002604A01 TABLE OF CONTENTS Chapter 1 MPact Architecture Overview 1.1 MPact Client Library...1-1 1.2 Platform Specific Notification

More information

Software Practice 3 Today s lecture Today s Task Porting Android App. in real device

Software Practice 3 Today s lecture Today s Task Porting Android App. in real device 1 Software Practice 3 Today s lecture Today s Task Porting Android App. in real device Prof. Hwansoo Han T.A. Jeonghwan Park 43 INTENT 2 3 Android Intent An abstract description of a message Request actions

More information

To gain access to the JCenter repository, make sure your app's build.gradle file includes the following:

To gain access to the JCenter repository, make sure your app's build.gradle file includes the following: Guides Android Documentation Document current as of 06/28/2018 12:37 PM. Installation Introduction Each SDL Android library release is published to JCenter. By adding a few lines in their app's gradle

More information

COLLEGE OF ENGINEERING, NASHIK-4

COLLEGE OF ENGINEERING, NASHIK-4 Pune Vidyarthi Griha s COLLEGE OF ENGINEERING, NASHIK-4 DEPARTMENT OF COMPUTER ENGINEERING 1) What is Android? Important Android Questions It is an open-sourced operating system that is used primarily

More information

Table of Content Android Tutorial... 2 Audience... 2 Prerequisites... 2 Copyright & Disclaimer Notice... 2 Overview... 7

Table of Content Android Tutorial... 2 Audience... 2 Prerequisites... 2 Copyright & Disclaimer Notice... 2 Overview... 7 Android Tutorial Table of Content Android Tutorial... 2 Audience... 2 Prerequisites... 2 Copyright & Disclaimer Notice... 2 Overview... 7 Features of Android... 7 Android Applications... 8 Environment

More information

Building User Interface for Android Mobile Applications II

Building User Interface for Android Mobile Applications II Building User Interface for Android Mobile Applications II Mobile App Development 1 MVC 2 MVC 1 MVC 2 MVC Android redraw View invalidate Controller tap, key pressed update Model MVC MVC in Android View

More information

Lifecycle Callbacks and Intents

Lifecycle Callbacks and Intents SE 435: Development in the Android Environment Recitations 2 3 Semester 1 5779 4 Dec - 11 Dec 2018 Lifecycle Callbacks and Intents In this recitation we ll prepare a mockup tool which demonstrates the

More information

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

Lecture 1 Introduction to Android. App Development for Mobile Devices. App Development for Mobile Devices. Announcement. CSCE 315: Android Lectures (1/2) Dr. Jaerock Kwon App Development for Mobile Devices Jaerock Kwon, Ph.D. Assistant Professor in Computer Engineering App Development for Mobile Devices Jaerock Kwon, Ph.D.

More information

Understanding and Detecting Wake Lock Misuses for Android Applications

Understanding and Detecting Wake Lock Misuses for Android Applications Understanding and Detecting Wake Lock Misuses for Android Applications Artifact Evaluated Yepang Liu, Chang Xu, Shing-Chi Cheung, and Valerio Terragni Code Analysis, Testing and Learning Research Group

More information

Wireless Vehicle Bus Adapter (WVA) Android Library Tutorial

Wireless Vehicle Bus Adapter (WVA) Android Library Tutorial Wireless Vehicle Bus Adapter (WVA) Android Library Tutorial Revision history 90001431-13 Revision Date Description A October 2014 Original release. B October 2017 Rebranded the document. Edited the document.

More information