Criado por Alex Neves
quase 9 anos atrás
|
||
Questão | Responda |
What is a Service? | A component with no UI |
What are they used for? | To perform long running tasks |
What is their lifetime? | They remain for as long as they are needed |
What process do they run in? | The same process as the instantiating app |
Name 4 example usages of a Service | MP3 playback, downloading a file, sending an email and polling for emails |
Name the 2 types of Services | Bound and Unbound |
What is an Unbound Service? | A service which runs indefinitely, controlled via calls to startService() and stopService() |
What is a Bound Service? | A Service which runs for as long as any activities are bound. When all clients unbind, the service is stopped. |
How do you communicate with a bound service? | Via an IBinder interface instance |
Name 2 examples of Unbound Services | Intent service and generic started service |
Describe an Intent Service | A service which queues intents. Handles intents one at a time via onHandleIntent(). Stops when queue has been processed. |
Give an example of an Intent Service | Sending an email |
Describe a Generic Started Service | A service which runs persistently. It receives messages requesting work to be done. |
Give an example of a Generic Started Service | Polling for emails |
What is a Foreground Service? | One which runs in the foreground, helping prevent termination. It provides a notification to users know it is running. |
How does a Local Bound Service work? | The Service extends the Binder class. After binding, an async callback is called providing the IBinder instance to the service. |
What is a Remote Bound Service? | One which can communicate across process boundaries. Likely to be used by multiple processes at once |
How can we define a Remote Service? | By using AIDL |
What does AIDL stand for? | Android Interface Definition Language |
What is AIDL? | The method for communicating across process boundaries. It is similar to Java interface syntax. |
What types does AIDL support? Name some examples | Primitives e.g. StringList and Map. Also support other AIDL interfaces and paracelable objects |
What is a Parcelable object? | One which is supported by the Android Kernel Drivier |
What types are Parcelable? | Primitives e.g. ints, strings, chars, bytes |
What is the benefit of Parcelable vs Java.IO.Serializable? | Supported by the kernel meaning it is fast. Java.IO.Serializable works via reflection and is therefore slow. |
Quer criar seus próprios Flashcards gratuitos com GoConqr? Saiba mais.