Lecture 7: Android Services

Slides:



Advertisements
Similar presentations
Services. Application component No user interface Two main uses Performing background processing Supporting remote method execution.
Advertisements

RPC Robert Grimm New York University Remote Procedure Calls.
Application Fundamentals Android Development. Announcements Posting in D2L Tutorials.
Lec 06 AsyncTask Local Services IntentService Broadcast Receivers.
Permissions.  Applications can protect resources & data with permissions  Applications statically declare permissions  Required of components interacting.
Remote Method Invocation Chin-Chih Chang. Java Remote Object Invocation In Java, the object is serialized before being passed as a parameter to an RMI.
Android Application Development Stephen Diniz Computer/Electrical Engineer Lecture 01 Introduction.
@2011 Mihail L. Sichitiu1 Android Introduction Application Fundamentals.
Emerging Platform#4: Android Bina Ramamurthy.  Android is an Operating system.  Android is an emerging platform for mobile devices.  Initially developed.
Chien-Chung Shen Manifest and Activity Chien-Chung Shen
Computer Science 209 The Strategy Pattern II: Emulating Higher-Order Functions.
CSE 486/586, Spring 2013 CSE 486/586 Distributed Systems Content Providers & Services.
© Keren Kalif Intro to Android Development Written by Keren Kalif, Edited by Liron Blecher Contains slides from Google I/O presentation.
COMP 365 Android Development.  Perform operations in the background  Services do not have a user interface (UI)  Can run without appearing on screen.
Android fundamentals yuan jin mar. 14, android lifecycle.
16 Services and Broadcast Receivers CSNB544 Mobile Application Development Thanks to Utexas Austin.
J2EE Structure & Definitions Catie Welsh CSE 432
CSCI 6962: Server-side Design and Programming Web Services.
CSE 486/586, Spring 2012 CSE 486/586 Distributed Systems Recitation.
Object-Oriented Programming (OOP). Implementing an OOD in Java Each class is stored in a separate file. All files must be stored in the same package.
CS378 - Mobile Computing Intents. Allow us to use applications and components that are part of Android System – start activities – start services – deliver.
5-Aug-2002cse Arrays © 2002 University of Washington1 Arrays CSE 142, Summer 2002 Computer Programming 1
Spring/2002 Distributed Software Engineering C:\unocourses\4350\slides\DefiningThreads 1 RMI.
1 Lecture 5 (part2) : “Interprocess communication” n reasons for process cooperation n types of message passing n direct and indirect message passing n.
Working in the Background Radan Ganchev Astea Solutions.
Services A Service is an application component that can perform long-running operations in the background and does not provide a user interface. An application.
Services 1 CS440. What is a Service?  Component that runs on background  Context.startService(), asks the system to schedule work for the service, to.
CS-2851 Dr. Mark L. Hornick 1 Generic Java Classes Implementing your own generic classes.
UMass Lowell Computer Science Java and Distributed Computing Prof. Karen Daniels Fall, 2000 Lecture 9 Java Fundamentals Objects/ClassesMethods Mon.
Remote Method Invocation by James Hunt, Joel Dominic, and Adam Mcculloch.
Lecture 4 Mechanisms & Kernel for NOSs. Mechanisms for Network Operating Systems  Network operating systems provide three basic mechanisms that support.
Developing Web Services with the Eclipse Web Tools Platform David Gallardo.
Modern Programming Language. Web Container & Web Applications Web applications are server side applications The most essential requirement.
Services Background operating component without a visual interface Running in the background indefinitely Differently from Activity, Service in Android.
.NET Mobile Application Development XML Web Services.
CSE 486/586, Spring 2014 CSE 486/586 Distributed Systems Android Programming Steve Ko Computer Sciences and Engineering University at Buffalo.
Technische Universität München Services, IPC and RPC Gökhan Yilmaz, Benedikt Brück.
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.
CopperDroid Logan Horton. Android - Background Android is complicated to analyse due to having 2 places to check for code execution Normally, code is.
Developing Android Services. Objectives Creating a service that runs in background Performing long-running tasks in a separate thread Performing repeated.
Why Learn Android? Largest installation base of any operating system Over 20,000 Android devices exist Businesses will likely move more to device-based.
TK1924 Program Design & Problem Solving Session 2011/2012
Android Application Development 1 6 May 2018
Sixth Lecture ArrayList Abstract Class and Interface
Basic 1960s It was designed to emphasize ease of use. Became widespread on microcomputers It is relatively simple. Will make it easier for people with.
Reactive Android Development
Instructor: Mazhar Hussain
Web Programming Developing Web Applications including Servlets, and Web Services using NetBeans 6.5 with GlassFish.V3.
Android Runtime – Dalvik VM
Chapter 5 Remote Procedure Call
Introducing Java Generics and Collections
C Language By Sra Sontisirikit
Activities and Intents
Anatomy of an Android Application
Android Application Development android.cs.uchicago.edu
Android Programming Lecture 9
Developing Android Services
Chapter 9 Web Services: JAX-RPC, WSDL, XML Schema, and SOAP
Building a CORBA Server
From C++ to Java Java history: Oak, toaster-ovens, internet language, panacea What it is O-O language, not a hybrid (cf. C++) compiled to byte-code, executed.
Programs and Classes A program is made up from classes
Introduction to Web Services
Lecture 5: Functions and Parameters
Chapter 42 Web Services.
slides created by Alyssa Harding
Mobile Programming Dr. Mohsin Ali Memon.
Subtype Substitution Principle
Activities, Fragments, and Intents
CIS 470 Mobile App Development
Presentation transcript:

Lecture 7: Android Services By: Eliav Menachi

Services Services are components that run in the background, without a user interface Android supports two types of services:. Local service: not accessible from other applications running on the device Remote service: accessible from other applications in addition to the application hosting the service

Local Services Started via Context.startService() Runs until: Context.stopService() stopSelf() See SimpleService example

Remote service Service that can be consumed by other processes via Remote Procedure Call (RPC) Android Interface Definition Language (AIDL): define the interface that will be exposed to clients

Building Remote service To build a remote service, you do the following: Write an AIDL file that defines your interface to clients Add the AIDL file to your Eclipse project - generate a Java interface from the AIDL file Implement the service and return the interface from the onBind() method Add the service configuration to your AndroidManifest.xml

1. Implementing AIDL AIDL is a simple syntax that lets you declare an interface with one or more methods The parameters and return values can be of any type, even other AIDL-generated interfaces you must import all non-built-in types, even if they are defined in the same package as your interface

AIDL Data types Data types that AIDL can support: Primitive types (int, boolean…) String List - the other side will receive an ArrayList Map - the other side will receive a HashMap CharSequence Other AIDL-generated interfaces Custom classes that implement the Parcelable protocol

2. Generate a Java interface from AIDL Add the AIDL file to your Eclipse project Eclipse will automatically call the AIDL compiler and will generate the Java interface from the AIDL file

3. Implementing AIDL Interface Write a class that extends android.app.Service Implement: Implement the interface method Implement the onBind() method

4. Service Configuration Add the service configuration to your AndroidManifest.xml <service android:name=".AIDLServiceImpl"> <intent-filter> <action android:name="bgu.eliav.AIDLServiceInterface" /> </intent-filter> </service>

Calling the Service copy the AIDL file to the client project AIDL compiler creates the interface Extends the ServiceConnection get a reference to the service call the bindService()

Service lifecycle