MediaBrowserServiceCompat.Result
class MediaBrowserServiceCompat.Result<T>
Completion handler for asynchronous callback methods in MediaBrowserServiceCompat.
Each of the methods that takes one of these to send the result must call either sendResult or sendError to respond to the caller with the given results or errors. If those functions return without calling sendResult or sendError, they must instead call detach before returning, and then may call sendResult or sendError when they are done. If sendResult, sendError, or detach is called twice, an exception will be thrown.
Those functions might also want to call sendProgressUpdate to send interim updates to the caller. If it is called after calling sendResult or sendError, an exception will be thrown.
Summary
Public functions |
|
|---|---|
Unit |
detach()Detach this message from the current thread and allow the |
Unit |
Notify the caller of a failure. |
Unit |
sendProgressUpdate(extras: Bundle?)Send an interim update to the caller. |
Unit |
sendResult(result: T?)Send the result back to the caller. |
Public functions
detach
fun detach(): Unit
Detach this message from the current thread and allow the sendResult call to happen later.
sendError
fun sendError(extras: Bundle?): Unit
Notify the caller of a failure. This is supported only when it is used in onCustomAction.
| Parameters | |
|---|---|
extras: Bundle? |
A bundle that contains extra data. |
sendProgressUpdate
fun sendProgressUpdate(extras: Bundle?): Unit
Send an interim update to the caller. This method is supported only when it is used in onCustomAction.
| Parameters | |
|---|---|
extras: Bundle? |
A bundle that contains extra data. |