Reactive Android Development

Slides:



Advertisements
Similar presentations
Categories of I/O Devices
Advertisements

USING ANDROID WITH THE INTERNET. Slide 2 Network Prerequisites The following must be included so as to allow the device to connect to the network The.
A CHAT CLIENT-SERVER MODULE IN JAVA BY MAHTAB M HUSSAIN MAYANK MOHAN ISE 582 FALL 2003 PROJECT.
Fall 2007cs4251 Distributed Computing Umar Kalim Dept. of Communication Systems Engineering 31/10/2007.
Multithreaded Java COMP1681 / SE15 Introduction to Programming Fast Track Session 3.
Cosc 4730 Brief return Sockets And HttpClient And AsyncTask.
An Introduction to Internetworking. Algorithm for client-server communication with UDP (connectionless) A SERVER A CLIENT Create a server-socket (listener)and.
Intro to Android Programming George Nychis Srinivasan Seshan.
Concurrency Recitation – 2/24 Nisarg Raval Slides by Prof. Landon Cox.
CSE 486/586 CSE 486/586 Distributed Systems PA Best Practices Steve Ko Computer Sciences and Engineering University at Buffalo.
Networking Nasrullah. Input stream Most clients will use input streams that read data from the file system (FileInputStream), the network (getInputStream()/getInputStream()),
Slow Web Site Problem Analysis Last Update Copyright 2013 Kenneth M. Chipps Ph.D. 1.
CS378 - Mobile Computing Web - WebView and Web Services.
Liang, Introduction to Java Programming, Eighth Edition, (c) 2011 Pearson Education, Inc. All rights reserved Concurrency in Android with.
Remote Unit Testing Milestone III Alex Riordan Brian Pruitt-Goddard.
DUE Hello World on the Android Platform.
16 Services and Broadcast Receivers CSNB544 Mobile Application Development Thanks to Utexas Austin.
BI-SW Training day Outline What is the EDT? Why should I care about it? How do I treat GUI objects properly? SwingWorker and its advantages.
1 Web Based Programming Section 8 James King 12 August 2003.
1 (Worker Queues) cs What is a Thread Pool? A collection of threads that are created once (e.g. when a server starts) That is, no need to create.
Li Tak Sing COMPS311F. Case study: consumers and producers A fixed size buffer which can hold at most certain integers. A number of producers which generate.
Introduction to Socket Programming in Android Jules White Bradley Dept. of Electrical and Computer Engineering Virginia Tech
Android networking 1. Network programming with Android If your Android is connected to a WIFI, you can connect to servers using the usual Java API, like.
Threads II IS Outline  Quiz  Thread review  Stopping a thread  java.util.Timer  Swing threads javax.swing.Timer  ProgressMonitor.
1 Client-Server Interaction. 2 Functionality Transport layer and layers below –Basic communication –Reliability Application layer –Abstractions Files.
Android Threads. Threads Android will show an “ANR” error if a View does not return from handling an event within 5 seconds Or, if some code running in.
FCM Workflow using GCM.
Threads. Readings r Silberschatz et al : Chapter 4.
Services Background operating component without a visual interface Running in the background indefinitely Differently from Activity, Service in Android.
CS533 - Concepts of Operating Systems 1 Threads, Events, and Reactive Objects - Alan West.
MT311 Java Application Development and Programming Languages Li Tak Sing ( 李德成 )
Concurrent TCP servers. The basic idea 1 client = 1 task. The task is alive as long until the connection is closed The task closes the connection.
R Some of these slides are from Prof Frank Lin SJSU. r Minor modifications are made. 1.
CHAPTER 6 Threads, Handlers, and Programmatic Movement.
Services. What is a Service? A Service is not a separate process. A Service is not a thread. A Service itself is actually very simple, providing two main.
Lecture 5 Page 1 CS 111 Summer 2013 Bounded Buffers A higher level abstraction than shared domains or simple messages But not quite as high level as RPC.
USING ANDROID WITH THE INTERNET. Slide 2 Lecture Summary Getting network permissions Working with the HTTP protocol Sending HTTP requests Getting results.
Small talk with the UI thread
Thread Pools (Worker Queues) cs
Asynchronous Task (AsyncTask) in Android
Reactive Android Development
Instructor: Mazhar Hussain
Background on the need for Synchronization
Android Boot Camp for Developers Using Java, 3E
Advanced Topics in Concurrency and Reactive Programming: Asynchronous Programming Majeed Kassis.
CSC Multiprocessor Programming, Spring, 2012
CS240: Advanced Programming Concepts
Android Mobile Application Development
Lecture 21 Concurrency Introduction
Lecture 28 Concurrent, Responsive GUIs
Reactive Android Development
#01 Client/Server Computing
Client-Server Computing
Client-Server Interaction
Threads II IS
Developing Android Services
Android Programming Lecture 8
Reactive Android Development
Reactive Android Development
Application Development A Tutorial Driven Course
Android Topics UI Thread and Limited processing resources
CS323 Android Topics Network Basics for an Android App
Android Topics Asynchronous Callsbacks
Design Components are Code Components
Android Developer Fundamentals V2
Threaded Programming in Python
Threads, Handlers, and AsyncTasks
Using threads for long running tasks.
Chapter 5 멀티스레드 u-Network Design Lab 4.
#01 Client/Server Computing
Presentation transcript:

Reactive Android Development CS 4593-02T & CS 5463-01T Summer 2016 Services, Threads, and "Push (Pull)"

Running jobs in the background Last time, we talked about the Intent Service Can not interact directly with the UI Results must be sent to the activity for it to handle Work requests run sequentially If one request blocks, all others must wait until it is finished An operation running on an intent service can not be interrupted If the result is no longer desired, it must be ignored after it arrives.

Running jobs in the background But earlier, we talked about Services Just a component without a UI and that can be running in the background IntentService is a subclass Regular Services run in the main thread of the application If performing an intensive or blocking task, it should launch a thread

Service Lifecycle

AsyncTask Very simple way to do work in the background doInBackground Code that will execute in the background onPostExecute Code that will execute in the main thread Good for GUI updates. Can be cancelled! Tasks are Queued Since HONEYCOMB, AsyncTasks execute sequentially to reduce bugs caused by parallel execution.

Threads Regular Java Threads Lifecycle is not managed by Android Java no longer provides mechanisms for killing threads directly My approach: Ensure that the main loop can't block indefinitely Check a 'should continue' member variable at each loop iteration Basically the same as the isCancelled method for AsyncTask

"Push" Notifications Most WiFi IP addresses are not routable This isn't true on campus, but is likely to be true at a coffee shop How can a central server contact devices?

"Push" Notifications How can a central server contact devices?

"Push" Notifications How can a central server contact devices? Let's assume that it can't!

"Push" Notifications How can a central server contact devices? Let's assume that it can't! What if the device contacted the server and waited for a response?

"Push" Notifications Basically, I'm implementing push notifications as a sort of slow HTTP server. The client connects and tries to read the server with a long timeout. The server only replies when it has something to send.

The Layout