Android Services & Local IPC: The Command Processor Pattern (Part 1)
|
|
- Deborah Montgomery
- 6 years ago
- Views:
Transcription
1 : The Command Processor Pattern (Part 1) Professor of Computer Science Institute for Software Integrated Systems Vanderbilt University Nashville, Tennessee, USA
2 Learning Objectives in this Part of the Module Understand the Command Processor pattern 2
3 Challenge: Processing a Long-Running Action Context Synchronous method calls in an Activity can block client for extended periods e.g., the downloadimage() call will block the DownloadActivity while the Download fetches the image DownloadActivity Process 1: Activity makes blocking call Download Process 3
4 Challenge: Processing a Long-Running Action Problems Android generates an Application Not Responding (ANR) dialog if an app doesn t respond to user input within a short time (~3 seconds) Calling a potentially lengthy operation like downloadimage() in the main thread can therefore be problematic DownloadActivity Process 1: Activity makes blocking call Download Process See developer.android.com/training/articles/perf-anr.html 4 for more on ANRs
5 Challenge: Processing a Long-Running Action Solution Create a command processor that encapsulates a download request as an object that can be passed to a to execute the request Download Activity Command Processor start Download onhandleintent 5
6 Challenge: Processing a Long-Running Action Solution Create a command processor that encapsulates a download request as an object that can be passed to a to execute the request This process works as follows: Implement a Download that inherits from Android s Intent Download Activity Context start Download onhandleintent Activity Manager start 6
7 Challenge: Processing a Long-Running Action Solution Create a command processor that encapsulates a download request as an object that can be passed to a to execute the request This process works as follows: Implement a Download that inherits from Android s Intent Activity creates Intent command designating Download as target Add URL & callback Messenger as extras Download Activity Context start Activity Manager start Download onhandleintent 7
8 Challenge: Processing a Long-Running Action Solution Create a command processor that encapsulates a download request as an object that can be passed to a to execute the request This process works as follows: Implement a Download that inherits from Android s Intent Activity creates Intent command designating Download as target Activity calls start() with Intent Download Activity Context start Activity Manager start Download onhandleintent 8
9 Challenge: Processing a Long-Running Action Solution Create a command processor that encapsulates a download request as an object that can be passed to a to execute the request This process works as follows: Implement a Download that inherits from Android s Intent Activity creates Intent command designating Download as target Activity calls start() with Intent Activity Manager starts Intent, which spawns internal thread Download Activity Context start Activity Manager start Download onhandleintent 9
10 Challenge: Processing a Long-Running Action Solution Create a command processor that encapsulates a download request as an object that can be passed to a to execute the request This process works as follows: Implement a Download that inherits from Android s Intent Activity creates Intent command designating Download as target Activity calls start() with Intent Activity Manager starts Intent, which spawns internal thread Download Activity Context start Activity Manager start Download onhandleintent Intent calls onhandleintent() to download image in separate thread See developer.android.com/reference/android/app/intent.html 10 for more
11 Command Processor Intent POSA1 Design Pattern GoF book contains description of similar Command pattern Packages a piece of application functionality as well as its parameterization in an object to make it usable in another context, such as later in time or in a different thread 11 has more info
12 Command Processor Applicability POSA1 Design Pattern When there s a need to decouple the decision of what piece of code should be executed from the decision of when this should happen e.g., specify, queue, & execute service requests at different times 12
13 Command Processor Applicability POSA1 Design Pattern When there s a need to decouple the decision of what piece of code should be executed from the decision of when this should happen When there s a need to ensure service enhancements don t break existing code 13
14 Command Processor Applicability POSA1 Design Pattern When there s a need to decouple the decision of what piece of code should be executed from the decision of when this should happen When there s a need to ensure service enhancements don t break existing code When additional capabilities (such as undo/redo & persistence) must be implemented consistently for all requests to a service 14
15 Command Processor Structure & Participants POSA1 Design Pattern Intent 15
16 Command Processor Structure & Participants POSA1 Design Pattern Intent + extras 16
17 Command Processor Structure & Participants POSA1 Design Pattern Activity 17
18 Command Processor Structure & Participants POSA1 Design Pattern Intent 18
19 Command Processor Structure & Participants POSA1 Design Pattern Context 19
20 Command Processor Dynamics POSA1 Design Pattern Creates the Intent & call send() 20
21 Command Processor Dynamics POSA1 Design Pattern Intent 21
22 Command Processor Dynamics POSA1 Design Pattern Call onhandleintent() to process the Intent 22
23 Command Processor Consequences + Client isn t blocked for duration of command processing POSA1 Design Pattern public void runmessengerdownload(view view) { String url = edittext.gettext().tostring(); Intent intent = new Intent(this, Download.class); intent.setdata(uri.parse (url)); Messenger messenger = new Messenger(handler); intent.putextra("messenger", messenger); } start(intent); Caller doesn t block 23
24 Command Processor Consequences + Client isn t blocked for duration of command processing + Allow different users to work with service in different ways via commands POSA1 Design Pattern public void onhandleintent(intent intent) { Bundle extras = intent.getextras(); if (extras!= null && extras.get("messenger")!= null) messengerdownload (intent); else broadcastdownload (intent); } 24
25 Command Processor Consequences Additional programming to handle info passed with commands (cf. Broker) POSA1 Design Pattern public void onhandleintent(intent intent) { Bundle extras = intent.getextras(); if (extras!= null && extras.get("messenger")!= null) messengerdownload (intent); else broadcastdownload (intent); } 25
26 Command Processor Consequences Additional programming to handle info passed with commands (cf. Broker) Supporting two-way operations requires additional patterns & IPC mechanisms POSA1 Design Pattern void sendpath (String outputpath, Messenger messenger) { Message msg = Message.obtain(); msg.arg1 = result; Bundle bundle = new Bundle(); bundle.putstring(result_path, outputpath); msg.setdata(bundle);... messenger.send(msg); } 26
27 Command Processor Known Uses Android Intent Many UI toolkits InterViews, ET++, MacApp, Swing, AWT, etc. Interpreters for commandline shells Java Runnable interface POSA1 Design Pattern developer.android.com/reference/android/app/intent.html 27
28 Summary Command Processor provides a relatively straightforward means for passing commands asynchronously between threads and/or processes in concurrent & networked software 28 has more info
29 : The Command Processor Pattern (Part 2) Professor of Computer Science Institute for Software Integrated Systems Vanderbilt University Nashville, Tennessee, USA
30 Learning Objectives in this Part of the Module Understand how Command Processor is applied in Android Client 1 start() Intent send intent oncreate() Intent 2 onstartcommand() Handler 3 sendmessage() handlemessage() queue intent MyIntent 4 onhandleintent() 5 dequeue intent process intent 30
31 Command Processor Implementation Define an abstract class for command execution that will be used by the executor Typically define an execute() operation POSA1 Design Pattern public class Intent implements Parcelable, Cloneable {... } 31
32 Command Processor Implementation Define an abstract class for command execution that will be used by the executor Add state which concrete commands need during their execution to the context Make the context available to the concrete command POSA1 Design Pattern public class Intent implements Parcelable, Cloneable {... public Intent setdata(uri data) { /*... */ } public Uri getdata() { /*... */ } public Intent putextra (String name, Bundle value) {/*... */ } } public Object getextra (String name) {/*... */ } 32
33 Command Processor Implementation Define an abstract class for command execution that will be used by the executor Add state which concrete commands need during their execution to the context Define & implement the creator e.g., using patterns like Abstract Factory or Factory Method POSA1 Design Pattern public class DownloadActivity extends Activity {... public void onclick(view v) { Intent intent = new Intent(DownloadActivity.this, Download.class);... intent.setdata (Uri.parse(userInput);... start(intent); }... 33
34 Command Processor Implementation Define an abstract class for command execution that will be used by the executor Add state which concrete commands need during their execution to the context Define & implement the creator Define the context If necessary allow it to keep references to command objects, but be aware of lifecycle issues POSA1 Design Pattern public abstract class Context { public abstract void sendbroadcast(intent intent); public abstract Intent registerreceiver (BroadcastReceiver receiver, IntentFilter filter); 34
35 Command Processor Implementation Define an abstract class for command execution that will be used by the executor Add state which concrete commands need during their execution to the context Define & implement the creator Define the context Implement specific command functionality in subclasses: Implementing the execute() operation, adding necessary attributes POSA1 Design Pattern public class Download extends Intent { }... protected void onhandleintent(intent intent) { downloadimage(intent); }... 35
36 Command Processor POSA1 Design Pattern Applying Command Processor in Android (Some) steps involved in the Android implementation of Command Processor pattern DownloadActivity Process Download Process DownloadActivity mmessenger start() 5: Return URI 1: Sent Intent to Activity Manager 2: Activity Manager starts the Download if it s not already running Activity Manager Download onhandleintent() 4: Download image & reply via Messenger 3: Intent base class queues the Intent & calls onhandleintent(), which runs in a separate thread Other patterns are involved here: Activator, 36 Messaging, Result Callback, etc.
37 Command Processor Applying Command Processor in Android (Portion of) the DownloadActivity implemented using the Command Processor pattern public void rundownloadimage(view view) { URL url = new URL(image_url.getText().toString()) Intent intent = new Intent(this, Download.class); Make Intent command POSA1 Design Pattern intent.putextra(download.messenger, new Messenger(handler)) intent.putextra(download.url, url); } start(intent); Issue request to command processor This code runs in the DownloadActivity 37 process
38 Command Processor Applying Command Processor in Android POSA1 Design Pattern (Portion of) the Download implemented using the Command Processor pattern Command processor executes the request public class Download extends Intent {... protected void onhandleintent(intent intent) { Bundle extras = intent.getextras(); URL url = (URL)extras.get(URL); Messenger messender (Messenger)extras.get(MESSANGER); } } // Download image at designated URL & send // reply back to Activity via messenger callback downloadimage(url, messenger); This code runs in a thread in 38 the Download process
39 Summary The Android Intent framework implements the Command Processor pattern & is used to process Intents in a background Thread Client 1 start() Intent send intent oncreate() Intent 2 onstartcommand() Handler 3 sendmessage() handlemessage() queue intent MyIntent 4 onhandleintent() 5 dequeue intent process intent 39
40 : Overview of Bound s d.schmidt@vanderbilt.edu Professor of Computer Science Institute for Software Integrated Systems Vanderbilt University Nashville, Tennessee, USA
41 Learning Objectives in this Part of the Module Understand how what a Bound is & what hook methods it defines to manage its various lifecycle states We ll emphasize commonalities & variabilities in our discussion 41
42 Interfacing with a Bound A Bound offers components an interface that clients can use to interact with the This interface can be generic e.g., using Messengers & Handlers for inter- or intra-process communication Messenger send() Handler handlemessage() Download Activity Download 42
43 Interfacing with a Bound A Bound offers components an interface that clients can use to interact with the This interface can be generic This interface can also be specific e.g., using the Android Interface Definition Language (AIDL) for inter- or intra-process communication interface IDownload { String downloadimage(in Uri uri); } Download Activity Download 43
44 Interfacing with a Bound A Bound offers components an interface that clients can use to interact with the This interface can be generic This interface can also be specific Both approaches use the Binder RPC mechanism This implements the Broker & Proxy patterns Download Activity Download 44
45 Launching a Bound A Bound allows App components to bind to it by calling bind() to create a persistent connection Intent intent = new Intent(IDownloadSync.class.getName()); bind(intent, this.conn, Context.BIND_AUTO_CREATE); Download Activity Download developer.android.com/guide/components/services.html#creatingbound 45
46 Launching a Bound A Bound allows App components to bind to it by calling bind() to create a persistent connection The client must provide Connection object to monitor the connection with the Intent intent = new Intent(IDownloadSync.class.getName()); bind(intent, this.conn, Context.BIND_AUTO_CREATE); Download Activity Download 46
47 Connecting a Bound When the client calls bind() Android starts the & invokes the s oncreate() & onbind() hook methods If the isn t already running it will be activated IDownload.Stub binder; Class Download extends { public void oncreate(bundle savedinstance) { binder = new IDownload.Stub() { public String downloadimage(string urlvalue) { /*... */ } } Download Activity... Download See 47 for info on Activator
48 Connecting a Bound When the client calls bind() Android starts the & invokes the s oncreate() & onbind() hook methods If the isn t already running it will be activated onbind() returns an IBinder object that defines the API for communicating with the Bound... public IBinder onbind(intent intent) { return this.binder; } Download Activity Download An interesting callback-driven protocol 48 is used to establish a connection
49 Connecting a Bound When the client calls bind() Android starts the & invokes the s oncreate() & onbind() hook methods The client needs to implement an onconnected() hook method to get a proxy to the IBinder Idownload syncsvc; Connection conn = new Connection() { public void onconnected (ComponentName classname, IBinder isvc) { syncsvc = IDownload.Stub.asInterface(iSvc); } Download Activity Download 49
50 Interfacing with a Bound A Bound offers components an interface that clients can use to interact with the, e.g.: Sending requests Getting results & Conversing across processes via IPC final String pathname = syncsvc.downloadimage(url); Download Activity Download Blocking call 50
51 Interfacing with a Bound A Bound offers components an interface that clients can use to interact with the, e.g.: Sending requests Getting results & Conversing across processes via IPC IDownload.Stub binder = new IDownload.Stub() { public String downloadimage(string url) { return downloadimagefromurl(url, DOWNLOADED_FILE_NAME_PREFIX); } Download Activity Download Run in a separate thread of control 51
52 Stopping a Bound When a Bound is launched, it has a lifecycle that's depends of the component(s) that access it i.e., it doesn t run in the background indefinitely When a client is done interacting with the service, it calls unbind() to unbind After there are no clients bound to the service it is destroyed Download Activity Download developer.android.com/guide/components/bound-services.html#lifecycle 52
53 It is possible to define hybrid models that combine Bound & Started s If a Bound implements onstartcommand() it won t be destroyed when it is unbound from all clients Hybrid Started & Bound Lifecycles developer.android.com/guide/components/bound-services.html#lifecycle 53
54 It is possible to define hybrid models that combine Bound & Started s If a Bound implements onstartcommand() it won t be destroyed when it is unbound from all clients If you return true when the system calls onunbind() the onrebind() method will be called the next time a client binds to the Instead of receiving a call to onbind() Hybrid Started & Bound Lifecycles developer.android.com/guide/components/bound-services.html#lifecycle 54
55 Protocol for Bound Interactions A protocol is used to interact between Activities & Bound s Client Process Server Process Binder IPC Mechanism 5: Assign Proxy to local variable Activity mdosomething bind() Connection onconnected() 6: Call the method dosomething() via Proxy 1: Bind to 2: Start Bound process if it s not already running 4: Downcast to Proxy mbinder onbind() ISomeBinder dosomething() 7: Stub dispatches to method & returns result 3: Return reference to object that implements the IBinder interface Many patterns are involved here: Broker, 55 Proxy, Activator, Adapter, etc.
56 Client Bound Interactions To bind to a service from your client, you must perform the following steps: Client Process Activity mdosomething bind() Connection onconnected() ondisconnected() 1. Implement Connection & override its two callback methods: onconnected() Android calls this to deliver the IBinder returned by the service's onbind() method ondisconnected() Android calls this when the connection to the service is unexpectedly lost e.g., when the service has crashed or has been killed (not called with client calls unbind()) 56
57 Client Bound Interactions To bind to a service from your client, you must perform the following steps: : Assign Proxy to local variable Client Process Activity mdosomething bind() Connection 1. Implement Connection & override its two callback methods 2. Call bind(), passing the Connection implementation onconnected() ondisconnected() 57
58 Client Bound Interactions To bind to a service from your client, you must perform the following steps: Client Process Activity mdosomething bind() Connection 1. Implement Connection & override its two callback methods 2. Call bind(), passing the Connection implementation 3. When the system calls your onconnected() callback method, you can begin making calls to the service, using the methods defined by the interface onconnected() ondisconnected() 58
59 Client Bound Interactions To bind to a service from your client, you must perform the following steps: Client Process Activity mdosomething unbind() Connection onconnected() ondisconnected() 1. Implement Connection & override its two callback methods 2. Call bind(), passing the Connection implementation 3. When the system calls your onconnected() callback method, you can begin making calls to the service, using the methods defined by the interface 4. To disconnect from the service, call unbind() When a client is destroyed, it is unbound from the automatically 59
60 Client Bound Interactions To bind to a service from your client, you must perform the following steps: Client Process Activity mdosomething unbind() Connection onconnected() ondisconnected() 1. Implement Connection & override its two callback methods 2. Call bind(), passing the Connection implementation 3. When the system calls your onconnected() callback method, you can begin making calls to the service, using the methods defined by the interface 4. To disconnect from the service, call unbind() Always unbind when you're done interacting with the service or when your activity pauses so that the service can shutdown while its not being used 60
61 Server Bound Interactions A Bound must perform the following steps when a client binds to it: When Android calls the 's onbind() Server Process method it returns an IBinder for interacting with the mbinder onbind() ISomeBinder 3: Return reference to object that implements the IBinder interface dosomething() 61
62 Server Bound Interactions A Bound must perform the following steps when a client binds to it: When Android calls the 's onbind() Server Process method it returns an IBinder for interacting with the The binding is asynchronous mbinder i.e., bind() returns immediately & does not return onbind() the IBinder to the client ISomeBinder dosomething() 62
63 Server Bound Interactions A Bound must perform the following steps when a client binds to it: When Android calls the 's onbind() Server Process method it returns an IBinder for interacting with the The binding is asynchronous mbinder To receive the IBinder, the client must create an instance of onbind() Connection & pass it to bind() ISomeBinder Connection implements dosomething() the onconnected() callback method that Android invokes to deliver the IBinder 63
64 Communicating with Bound s When creating a Bound, you must provide an IBinder via an interface clients can use to interact with the via one of the following Client Process Activity Extending the Binder class If your service runs in the same process as the client you can Server Process mdosomething extend the Binder class & return an instance mbinder from onbind() bind() onbind() Connection onconnected() ISomeBinder dosomething() 64
65 Communicating with Bound s When creating a Bound, you must provide an IBinder via an interface clients can use to interact with the via one of the following Client Process Extending the Binder class Server Process Using a Messenger Activity Create an interface for the mdosomething mbinder with a Messenger that allows the client to send bind() Connection commands to the across processes Doesn t require thread-safe components onbind() ISomeBinder onconnected() dosomething() 65
66 Communicating with Bound s When creating a Bound, you must provide an IBinder via an interface clients can use to interact with the via one of the following Client Process Extending the Binder class Server Process Using a Messenger Activity Using Android Interface mdosomething mbinder Definition Language (AIDL) bind() Connection AIDL performs all the work to decompose objects into primitives that Linux can understand & marshal them onbind() ISomeBinder onconnected() across processes to perform IPC Does require thread-safe components dosomething() 66
67 Summary Apps can use s to implement longrunning operations in the background Download Activity Download 67
68 Summary Apps can use s to implement longrunning operations in the background Started s are simple to program Download Activity Download 68
69 Summary Apps can use s to implement longrunning operations in the background Started s are simple to program Bound s provide more powerful communication models Download Activity Download 69
70 Summary Apps can use s to implement longrunning operations in the background Started s are simple to program Bound s provide more powerful communication models Examples of Android Bound s: BluetoothHeadset Provides Bluetooth Headset & Handsfree as in Phone App MediaPlayback Provides "background" audio playback capabilities Exchange s Manage operations, such as sending messages See packages/apps in Android 70 source code for many 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 informationServices. 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 informationServices. Background operating component without a visual interface Running in the background indefinitely
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
More informationAndroid 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 informationServices & 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 informationServices. 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 informationServices 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 informationEMBEDDED 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 informationBenefits of Concurrency in Java & Android: Program Structure
Benefits of Concurrency in Java & Android: Program Structure Douglas C. Schmidt d.schmidt@vanderbilt.edu www.dre.vanderbilt.edu/~schmidt Institute for Software Integrated Systems Vanderbilt University
More informationOverview 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 informationAndroid 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 informationBroadcast 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 informationMobile 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 informationServices. 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 informationOverview of Patterns: Introduction
: Introduction d.schmidt@vanderbilt.edu www.dre.vanderbilt.edu/~schmidt Professor of Computer Science Institute for Software Integrated Systems Vanderbilt University Nashville, Tennessee, USA Introduction
More informationANDROID 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 informationCS378 -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 informationAndroid. 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 informationUnderstand 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 informationMOBILE 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 informationSoftware 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 informationAndroid 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 informationMultiple 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 informationServices 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 informationThe Java ExecutorService (Part 1)
The Java ExecutorService (Part 1) Douglas C. Schmidt d.schmidt@vanderbilt.edu www.dre.vanderbilt.edu/~schmidt Institute for Software Integrated Systems Vanderbilt University Nashville, Tennessee, USA Learning
More informationAndroid 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 informationThe Java Executor (Part 1)
The Java Executor (Part 1) Douglas C. Schmidt d.schmidt@vanderbilt.edu www.dre.vanderbilt.edu/~schmidt Institute for Software Integrated Systems Vanderbilt University Nashville, Tennessee, USA Learning
More informationOverview of Java Threads (Part 3)
Overview of Java Threads (Part 3) Douglas C. Schmidt d.schmidt@vanderbilt.edu www.dre.vanderbilt.edu/~schmidt Institute for Software Integrated Systems Vanderbilt University Nashville, Tennessee, USA Learning
More informationProduced 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 informationProgramming 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 informationInfrastructure Middleware (Part 3): Android Runtime Core & Native Libraries
Infrastructure Middleware (Part 3): Android Runtime Core & Native Libraries Douglas C. Schmidt d.schmidt@vanderbilt.edu www.dre.vanderbilt.edu/~schmidt Institute for Software Integrated Systems Vanderbilt
More informationA Case Study of Gang of Four (GoF) Patterns : Part 7
A Case Study of Gang of Four (GoF) Patterns : Part 7 d.schmidt@vanderbilt.edu www.dre.vanderbilt.edu/~schmidt Professor of Computer Science Institute for Software Integrated Systems Vanderbilt University
More informationCHAPTER - 4 REMOTE COMMUNICATION
CHAPTER - 4 REMOTE COMMUNICATION Topics Introduction to Remote Communication Remote Procedural Call Basics RPC Implementation RPC Communication Other RPC Issues Case Study: Sun RPC Remote invocation Basics
More informationAndroid Programming Lecture 7 9/23/2011
Android Programming Lecture 7 9/23/2011 Multiple Activities So far, projects limited to one Activity Next step: Intra-application communication Having multiple activities within own application Inter-application
More informationMobile 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 informationMobile 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 informationOverview of Java Threads (Part 2)
Overview of Java Threads (Part 2) Douglas C. Schmidt d.schmidt@vanderbilt.edu www.dre.vanderbilt.edu/~schmidt Institute for Software Integrated Systems Vanderbilt University Nashville, Tennessee, USA Learning
More informationMobile 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 informationLecture 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 informationAndroid Ecosystem and. Revised v4presenter. What s New
Android Ecosystem and Revised v4presenter What s New Why Mobile? 5B 4B 3B 2B 1B Landlines PCs TVs Bank users Mobiles 225M AOL 180M 135M 90M 45M 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 Quarters
More informationInfrastructure Middleware (Part 1): Hardware Abstraction Layer (HAL)
Infrastructure Middleware (Part 1): Douglas C. Schmidt d.schmidt@vanderbilt.edu www.dre.vanderbilt.edu/~schmidt Institute for Software Integrated Systems Vanderbilt University Nashville, Tennessee, USA
More informationOverview of Patterns
d.schmidt@vanderbilt.edu www.dre.vanderbilt.edu/~schmidt Professor of Computer Science Institute for Software Integrated Systems Vanderbilt University Nashville, Tennessee, USA Topics Covered in this Module
More informationEfficient Android Threading
.... - J.', ' < '.. Efficient Android Threading Anders Göransson Beijing Cambridge Farnham Köln Sebastopol Tokyo O'REILLY Table of Contents Preface xi 1. Android Components and the Need for Multiprocessing
More informationANDROID 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 informationMultithreading and Interactive Programs
Multithreading and Interactive Programs CS160: User Interfaces John Canny. Last time Model-View-Controller Break up a component into Model of the data supporting the App View determining the look of the
More informationDesign Patterns Reid Holmes
Material and some slide content from: - Head First Design Patterns Book - GoF Design Patterns Book Design Patterns Reid Holmes GoF design patterns $ %!!!! $ "! # & Pattern vocabulary Shared vocabulary
More informationMultithreading and Interactive Programs
Multithreading and Interactive Programs CS160: User Interfaces John Canny. This time Multithreading for interactivity need and risks Some design patterns for multithreaded programs Debugging multithreaded
More informationOutline. 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 informationUpcoming 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 informationUnderstanding 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 informationApplication 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 informationProgramming with Android: Intents. Luca Bedogni. Dipartimento di Scienze dell Informazione Università di Bologna
Programming with Android: Intents Luca Bedogni Dipartimento di Scienze dell Informazione Università di Bologna Outline What is an intent? Intent description Handling Explicit Intents Handling implicit
More informationCS 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 informationOutline. Interprocess Communication. Interprocess Communication. Communication Models: Message Passing and shared Memory.
Eike Ritter 1 Modified: October 29, 2012 Lecture 14: Operating Systems with C/C++ School of Computer Science, University of Birmingham, UK Outline 1 2 3 Shared Memory in POSIX systems 1 Based on material
More informationOverview of Java s Support for Polymorphism
Overview of Java s Support for Polymorphism Douglas C. Schmidt d.schmidt@vanderbilt.edu www.dre.vanderbilt.edu/~schmidt Professor of Computer Science Institute for Software Integrated Systems Vanderbilt
More informationAndroid framework. How to use it and extend it
Android framework How to use it and extend it Android has got in the past three years an explosive growth: it has reached in Q1 2011 the goal of 100M of Activations world wide with a number of daily activations
More informationCS378 - 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 informationAndroid System Architecture. Android Application Fundamentals. Applications in Android. Apps in the Android OS. Program Model 8/31/2015
Android System Architecture Android Application Fundamentals Applications in Android All source code, resources, and data are compiled into a single archive file. The file uses the.apk suffix and is used
More informationImplementing 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 informationJava 8 Parallel ImageStreamGang Example (Part 3)
Java 8 Parallel ImageStreamGang Example (Part 3) Douglas C. Schmidt d.schmidt@vanderbilt.edu www.dre.vanderbilt.edu/~schmidt Professor of Computer Science Institute for Software Integrated Systems Vanderbilt
More informationThe Java FutureTask. Douglas C. Schmidt
The Java FutureTask Douglas C. Schmidt d.schmidt@vanderbilt.edu www.dre.vanderbilt.edu/~schmidt Institute for Software Integrated Systems Vanderbilt University Nashville, Tennessee, USA Learning Objectives
More informationProduced 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 informationDESIGN PATTERN - INTERVIEW QUESTIONS
DESIGN PATTERN - INTERVIEW QUESTIONS http://www.tutorialspoint.com/design_pattern/design_pattern_interview_questions.htm Copyright tutorialspoint.com Dear readers, these Design Pattern Interview Questions
More informationMobile 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 informationCS 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 informationLecture 5: Object Interaction: RMI and RPC
06-06798 Distributed Systems Lecture 5: Object Interaction: RMI and RPC Distributed Systems 1 Recap Message passing: send, receive synchronous versus asynchronous No global Time types of failure socket
More informationApp 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 informationANDROID 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 informationCS555: Distributed Systems [Fall 2017] Dept. Of Computer Science, Colorado State University
CS 555: DISTRIBUTED SYSTEMS [RPC & DISTRIBUTED OBJECTS] Shrideep Pallickara Computer Science Colorado State University Frequently asked questions from the previous class survey XDR Standard serialization
More informationLECTURE 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 informationACTIVITY, 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 informationCS 162 Operating Systems and Systems Programming Professor: Anthony D. Joseph Spring Lecture 22: Remote Procedure Call (RPC)
CS 162 Operating Systems and Systems Programming Professor: Anthony D. Joseph Spring 2002 Lecture 22: Remote Procedure Call (RPC) 22.0 Main Point Send/receive One vs. two-way communication Remote Procedure
More informationProduced 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 informationMTAT Enterprise System Integration. Lecture 2: Middleware & Web Services
MTAT.03.229 Enterprise System Integration Lecture 2: Middleware & Web Services Luciano García-Bañuelos Slides by Prof. M. Dumas Overall view 2 Enterprise Java 2 Entity classes (Data layer) 3 Enterprise
More informationAndroid for Ubiquitous Computing Researchers. Andrew Rice University of Cambridge 17-Sep-2011
Android for Ubiquitous Computing Researchers Andrew Rice University of Cambridge 17-Sep-2011 Getting started Website for the tutorial: http://www.cl.cam.ac.uk/~acr31/ubicomp/ Contains links to downloads
More informationCHAPTER 3 - PROCESS CONCEPT
CHAPTER 3 - PROCESS CONCEPT 1 OBJECTIVES Introduce a process a program in execution basis of all computation Describe features of processes: scheduling, creation, termination, communication Explore interprocess
More informationANDROID 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 informationLecture 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 informationLecture 3 Android Internals
Lecture 3 Android Internals 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
More informationSyllabus- Java + Android. Java Fundamentals
Introducing the Java Technology Syllabus- Java + Android Java Fundamentals Key features of the technology and the advantages of using Java Using an Integrated Development Environment (IDE) Introducing
More informationLecture 06: Distributed Object
Lecture 06: Distributed Object Distributed Systems Behzad Bordbar School of Computer Science, University of Birmingham, UK Lecture 0? 1 Recap Interprocess communication Synchronous and Asynchronous communication
More informationBITalino Java Application Programming Interface. Documentation Android API
BITalino Java Application Programming Interface Documentation Android API Contents Contents...2 1. General Information...3 2. Introduction...4 3. Main Objects...5 3.1.Class BITalinoDescription...5 3.2.Class
More informationActivities and Fragments
Activities and Fragments 21 November 2017 Lecture 5 21 Nov 2017 SE 435: Development in the Android Environment 1 Topics for Today Activities UI Design and handlers Fragments Source: developer.android.com
More informationDesign Pattern- Creational pattern 2015
Creational Patterns Abstracts instantiation process Makes system independent of how its objects are created composed represented Encapsulates knowledge about which concrete classes the system uses Hides
More informationInformation-Flow Analysis of Android Applications in DroidSafe
Information-Flow Analysis of Android Applications in DroidSafe Michael I. Gordon, Deokhwan Kim, Jeff Perkins, and Martin Rinard MIT CSAIL Limei Gilham Kestrel Institute Nguyen Nguyen Global InfoTek, Inc.
More informationCOSC 3P97 Mobile Computing
COSC 3P97 Mobile Computing Mobile Computing 1.1 COSC 3P97 Prerequisites COSC 2P13, 3P32 Staff instructor: Me! teaching assistant: Steve Tkachuk Lectures (MCD205) Web COSC: http://www.cosc.brocku.ca/ COSC
More informationWriting Efficient Drive Apps for Android. Claudio Cherubino / Alain Vongsouvanh Google Drive Developer Relations
Writing Efficient Drive Apps for Android Claudio Cherubino / Alain Vongsouvanh Google Drive Developer Relations Raise your hand if you use Google Drive source: "put your hands up!" (CC-BY) Raise the other
More informationCS378 -Mobile Computing. Intents
CS378 -Mobile Computing Intents Intents Allow us to use applications and components that are part of Android System and allow other applications to use the components of the applications we create Examples
More informationContent Provider. Introduction 01/03/2016. Session objectives. Content providers. Android programming course. Introduction. Built-in Content Provider
Android programming course Session objectives Introduction Built-in Custom By Võ Văn Hải Faculty of Information Technologies 2 Content providers Introduction Content providers manage access to a structured
More informationChapter 3: Processes. Operating System Concepts 8th Edition
Chapter 3: Processes Chapter 3: Processes Process Concept Process Scheduling Operations on Processes Interprocess Communication Examples of IPC Systems Communication in Client-Server Systems 3.2 Objectives
More informationCAS 703 Software Design
Dr. Ridha Khedri Department of Computing and Software, McMaster University Canada L8S 4L7, Hamilton, Ontario Acknowledgments: Material based on Software by Tao et al. (Chapters 9 and 10) (SOA) 1 Interaction
More informationLecture 8: February 19
CMPSCI 677 Operating Systems Spring 2013 Lecture 8: February 19 Lecturer: Prashant Shenoy Scribe: Siddharth Gupta 8.1 Server Architecture Design of the server architecture is important for efficient and
More informationThreads Questions Important Questions
Threads Questions Important Questions https://dzone.com/articles/threads-top-80-interview https://www.journaldev.com/1162/java-multithreading-concurrency-interviewquestions-answers https://www.javatpoint.com/java-multithreading-interview-questions
More informationProgramming in Android. Nick Bopp
Programming in Android Nick Bopp nbopp@usc.edu Types of Classes Activity This is the main Android class that you will be using. These are actively displayed on the screen and allow for user interaction.
More informationLifecycle-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 informationSHWETANK KUMAR GUPTA Only For Education Purpose
Introduction Android: INTERVIEW QUESTION AND ANSWER Android is an operating system for mobile devices that includes middleware and key applications, and uses a modified version of the Linux kernel. It
More informationMobile 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 informationCOLLEGE 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 informationAnswers to Exercises
Answers to Exercises CHAPTER 1 ANSWERS 1. What is an AVD? Ans: An AVD is an Android Virtual Device. It represents an Android emulator, which emulates a particular configuration of an actual Android device.
More informationDistributed Objects and Remote Invocation. Programming Models for Distributed Applications
Distributed Objects and Remote Invocation Programming Models for Distributed Applications Extending Conventional Techniques The remote procedure call model is an extension of the conventional procedure
More information