Lecture 14: Bound Services Flashcards

1
Q

Services may be ___, ___ or both depending on the circumstances

A
  • started
  • bound
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
2
Q

Boud services define the ___ and ___ lifecycle functions, but can also define an ___ method

A
  • onBind()
  • onUnbind()
  • onStartCommand()
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
3
Q

We can think of a bound service as a form of __ relationship

A

client-server

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
4
Q

The bound service represents the __, while the activities that are bound to it act like ___

A
  • server
  • clients
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
5
Q

The purpose of a bound service is to allow a client to ___, or ___

A
  • pass to or from the service
  • call methods defined within the service
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
6
Q

The simplest way to create a bound service is to use the ____, but this has some limitations

A

extend the existing Binder interface

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
7
Q

The binder class is a form of ___ meaning it allows ___

A
  • RPCC (Remote Procedural Call)
  • one process to remotely call methods in another process
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
8
Q

Bound services that use the Binder interface can only be bound to ___ within the same ___

A
  • activities/services/etc
  • same application
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
9
Q

If you want to bind your service to an external activity/service you’ll need a ____

A

Messager

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
10
Q

To set up a service to accept bindings you need a ___variable that contains an ___

A
  • class
  • extended instance of a Binder
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
11
Q

onBind() returns the ___

A

binder object to the client for binding

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
12
Q

The LocalBinder is an extension of Binder and implements one class: ___, which provides the ___

A
  • getService()
  • client with a local reference to the running service
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
13
Q

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 ___

A
  • keep track of the service
  • manage the binding on the activity side
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
14
Q

The ServieConnection has a callback which we can use to set the ___ and change the ___

A
  • LocalService reference
  • binding status of the application
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
15
Q

Within the Activity, a callback is created with a ___ thats used to handle the actual binding and unbinding procedure

A

ServiceConnection

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
16
Q

The ServiceConnection object defines __ and __ methods which we use to set/unset the service and bound refs

A
  • onServiceConnected
  • onServiceDisconnected
17
Q

Once we have a valid reference to the service, we can call __ belonging to that service directly from the reference

A

public methods

18
Q

boundRef provides a simple Boolean check to see if the service is ___

A

bound and available (skipping if its not)

19
Q

The code in the onServiceConnected() method is what takes the ___ from the service and calls the ___ method we defined back in the LocalBinder class

A
  • binder
  • getService()
20
Q

A service created through binding will cease to exist once ___

A

all bound connections are closed

21
Q

If you only have one activity bound to the service and it ever unbinds your service will ___

A

terminate and any persistent storage or data it might have contained is gone

22
Q

Its possible for a service to define both ___ methods and __ methods, meaning it can be launched bound or unbound

A
  • starting
  • binding
23
Q

If a service is launched as unbound and then later bound, it follows the ___ – it will not ___ when unbound

A
  • unbound lifecycle
  • automatically terminate
24
Q

Fundamentally binding a service just means youre allowing other participants (activities, services,etc) to ____

A

call methods contained within the service