PendingResult
open class PendingResult
kotlin.Any | |
↳ | android.content.BroadcastReceiver.PendingResult |
State for a result that is pending for a broadcast receiver. Returned by goAsync()
while in BroadcastReceiver.onReceive()
. This allows you to return from onReceive() without having the broadcast terminate; you must call finish()
once you are done with the broadcast. This allows you to process the broadcast off of the main thread of your app.
Note on threading: the state inside of this class is not itself thread-safe. However, you can use it from any thread if you make sure that you do not have races. Typically this means you will hand the entire object to another thread, which will be solely responsible for setting any results and finally calling finish()
.
Summary
Public methods | |
---|---|
Unit |
Version of |
Unit |
Version of |
Unit |
finish() Finish the broadcast. |
Boolean |
Version of |
Int |
Version of |
String! |
Version of |
Bundle! |
getResultExtras(makeMap: Boolean) Version of |
Unit |
Version of |
Unit |
setResultCode(code: Int) Version of |
Unit |
setResultData(data: String!) Version of |
Unit |
setResultExtras(extras: Bundle!) Version of |
Public methods
abortBroadcast
fun abortBroadcast(): Unit
Version of BroadcastReceiver.abortBroadcast()
for asynchronous broadcast handling.
clearAbortBroadcast
fun clearAbortBroadcast(): Unit
Version of BroadcastReceiver.clearAbortBroadcast()
for asynchronous broadcast handling.
finish
fun finish(): Unit
Finish the broadcast. The current result will be sent and the next broadcast will proceed.
getAbortBroadcast
fun getAbortBroadcast(): Boolean
Version of BroadcastReceiver.getAbortBroadcast()
for asynchronous broadcast handling.
getResultCode
fun getResultCode(): Int
Version of BroadcastReceiver.getResultCode()
for asynchronous broadcast handling.
getResultData
fun getResultData(): String!
Version of BroadcastReceiver.getResultData()
for asynchronous broadcast handling.
getResultExtras
fun getResultExtras(makeMap: Boolean): Bundle!
Version of BroadcastReceiver.getResultExtras(boolean)
for asynchronous broadcast handling.
setResult
fun setResult(
code: Int,
data: String!,
extras: Bundle!
): Unit
Version of BroadcastReceiver.setResult(int, String, Bundle)
for asynchronous broadcast handling.
setResultCode
fun setResultCode(code: Int): Unit
Version of BroadcastReceiver.setResultCode(int)
for asynchronous broadcast handling.
setResultData
fun setResultData(data: String!): Unit
Version of BroadcastReceiver.setResultData(String)
for asynchronous broadcast handling.
setResultExtras
fun setResultExtras(extras: Bundle!): Unit
Version of BroadcastReceiver.setResultExtras(Bundle)
for asynchronous broadcast handling.