Lecture 14: Bound Services Flashcards
Services may be ___, ___ or both depending on the circumstances
- started
- bound
Boud services define the ___ and ___ lifecycle functions, but can also define an ___ method
- onBind()
- onUnbind()
- onStartCommand()
We can think of a bound service as a form of __ relationship
client-server
The bound service represents the __, while the activities that are bound to it act like ___
- server
- clients
The purpose of a bound service is to allow a client to ___, or ___
- pass to or from the service
- call methods defined within the service
The simplest way to create a bound service is to use the ____, but this has some limitations
extend the existing Binder interface
The binder class is a form of ___ meaning it allows ___
- RPCC (Remote Procedural Call)
- one process to remotely call methods in another process
Bound services that use the Binder interface can only be bound to ___ within the same ___
- activities/services/etc
- same application
If you want to bind your service to an external activity/service you’ll need a ____
Messager
To set up a service to accept bindings you need a ___variable that contains an ___
- class
- extended instance of a Binder
onBind() returns the ___
binder object to the client for binding
The LocalBinder is an extension of Binder and implements one class: ___, which provides the ___
- getService()
- client with a local reference to the running service
When an activity is performing the bind we need to keep track of a few things.
We need a class reference to ____ and a ServiceConnection object to ___
- keep track of the service
- manage the binding on the activity side
The ServieConnection has a callback which we can use to set the ___ and change the ___
- LocalService reference
- binding status of the application
Within the Activity, a callback is created with a ___ thats used to handle the actual binding and unbinding procedure
ServiceConnection