Android Dev Summit, October 23-24: two days of technical content, directly from the Android team. Sign-up for livestream updates.

RemoteCallback

public class RemoteCallback
extends Object

java.lang.Object
   ↳ androidx.remotecallback.RemoteCallback


An instance of a callback to a specific class/method with a specific set of arguments. Can only be obtained from a CallbackReceiver.

Summary

Constants

int TYPE_PROVIDER

Constant indicating this callback will be triggered on a ContentProvider.

int TYPE_RECEIVER

Constant indicating this callback will be triggered on a BroadcastReceiver.

Fields

public static final RemoteCallback LOCAL

Constant value that actual implementations of RemoteCallable should return.

Public methods

static <T extends CallbackReceiver> T create(Class<T> cls, Context context)

Static version of CallbackReceiver.createRemoteCallback(Context).

Bundle getArgumentBundle()

Gets the bundle of arguments that will be used to trigger the method.

String getMethodName()

Gets the name of the method this callback will call.

String getReceiverClass()

Gets the class the callback will be called on.

int getType()

Get the type of the receiver of this callback.

PendingIntent toPendingIntent()

Create a PendingIntent that will trigger this callback.

Inherited methods

Constants

TYPE_PROVIDER

public static final int TYPE_PROVIDER

Constant indicating this callback will be triggered on a ContentProvider.

Constant Value: 1 (0x00000001)

TYPE_RECEIVER

public static final int TYPE_RECEIVER

Constant indicating this callback will be triggered on a BroadcastReceiver.

Constant Value: 0 (0x00000000)

Fields

LOCAL

public static final RemoteCallback LOCAL

Constant value that actual implementations of RemoteCallable should return.

Public methods

create

public static T create (Class<T> cls, 
                Context context)

Static version of CallbackReceiver.createRemoteCallback(Context).

Parameters
cls Class

context Context

Returns
T

getArgumentBundle

public Bundle getArgumentBundle ()

Gets the bundle of arguments that will be used to trigger the method.

Returns
Bundle

getMethodName

public String getMethodName ()

Gets the name of the method this callback will call.

Returns
String

getReceiverClass

public String getReceiverClass ()

Gets the class the callback will be called on.

Returns
String

getType

public int getType ()

Get the type of the receiver of this callback.

Returns
int

toPendingIntent

public PendingIntent toPendingIntent ()

Create a PendingIntent that will trigger this callback.

Returns
PendingIntent