# Print output for @column tags ?> BroadcastReceiver.PendingResult - Android SDK | Android Developers

Most visited


Recently visited


BroadcastReceiver.PendingResult

public static class BroadcastReceiver.PendingResult
extends Object

java.lang.Object
   ↳ android.content.BroadcastReceiver.PendingResult


State for a result that is pending for a broadcast receiver. Returned by BroadcastReceiver#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 properly 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

final void abortBroadcast()

Version of BroadcastReceiver#abortBroadcast() for asynchronous broadcast handling.

final void clearAbortBroadcast()

Version of BroadcastReceiver#clearAbortBroadcast() for asynchronous broadcast handling.

final void finish()

Finish the broadcast.

final boolean getAbortBroadcast()

Version of BroadcastReceiver#getAbortBroadcast() for asynchronous broadcast handling.

final int getResultCode()

Version of BroadcastReceiver#getResultCode() for asynchronous broadcast handling.

final String getResultData()

Version of BroadcastReceiver#getResultData() for asynchronous broadcast handling.

final Bundle getResultExtras(boolean makeMap)

Version of BroadcastReceiver#getResultExtras(boolean) for asynchronous broadcast handling.

final void setResult(int code, String data, Bundle extras)

Version of BroadcastReceiver#setResult(int, String, Bundle) for asynchronous broadcast handling.

final void setResultCode(int code)

Version of BroadcastReceiver#setResultCode(int) for asynchronous broadcast handling.

final void setResultData(String data)

Version of BroadcastReceiver#setResultData(String) for asynchronous broadcast handling.

final void setResultExtras(Bundle extras)

Version of BroadcastReceiver#setResultExtras(Bundle) for asynchronous broadcast handling.

Inherited methods

Public methods


abortBroadcast

public final void abortBroadcast ()

Version of BroadcastReceiver#abortBroadcast() for asynchronous broadcast handling.

clearAbortBroadcast

public final void clearAbortBroadcast ()

Version of BroadcastReceiver#clearAbortBroadcast() for asynchronous broadcast handling.

finish

public final void finish ()

Finish the broadcast. The current result will be sent and the next broadcast will proceed.

getAbortBroadcast

public final boolean getAbortBroadcast ()

Version of BroadcastReceiver#getAbortBroadcast() for asynchronous broadcast handling.

Returns
boolean

getResultCode

public final int getResultCode ()

Version of BroadcastReceiver#getResultCode() for asynchronous broadcast handling.

Returns
int

getResultData

public final String getResultData ()

Version of BroadcastReceiver#getResultData() for asynchronous broadcast handling.

Returns
String

getResultExtras

public final Bundle getResultExtras (boolean makeMap)

Version of BroadcastReceiver#getResultExtras(boolean) for asynchronous broadcast handling.

Parameters
makeMap boolean

Returns
Bundle

setResult

public final void setResult (int code, 
                String data, 
                Bundle extras)

Version of BroadcastReceiver#setResult(int, String, Bundle) for asynchronous broadcast handling.

Parameters
code int

data String

extras Bundle

setResultCode

public final void setResultCode (int code)

Version of BroadcastReceiver#setResultCode(int) for asynchronous broadcast handling.

Parameters
code int

setResultData

public final void setResultData (String data)

Version of BroadcastReceiver#setResultData(String) for asynchronous broadcast handling.

Parameters
data String

setResultExtras

public final void setResultExtras (Bundle extras)

Version of BroadcastReceiver#setResultExtras(Bundle) for asynchronous broadcast handling.

Parameters
extras Bundle

Browse this site in English?

You requested a page in English, but your language preference for this site is English.

Would you like to change your language preference and browse this site in English? If you want to change your language preference later, use the language menu at the bottom of each page.