Register now for Android Dev Summit 2019!

CallbackHandlerRegistry

public class CallbackHandlerRegistry
extends Object

java.lang.Object
   ↳ androidx.remotecallback.CallbackHandlerRegistry


The holder for callbacks that are tagged with RemoteCallable. Note: This should only be referenced by generated code, there is no reason to reference this otherwise.

Summary

Nested classes

interface CallbackHandlerRegistry.CallbackHandler<T extends CallbackReceiver>

The interface used to trigger a callback when the pending intent is fired. 

Public constructors

CallbackHandlerRegistry()

Public methods

<T extends CallbackReceiver> void invokeCallback(Context context, T receiver, Intent intent)

Trigger a call to a callback using arguments that were generated with RemoteCallback.getArgumentBundle().

<T extends CallbackReceiver> void invokeCallback(Context context, T receiver, Bundle bundle)

Trigger a call to a callback using arguments that were generated with RemoteCallback.getArgumentBundle().

static <T extends CallbackReceiver> void registerCallbackHandler(Class<T> cls, String method, CallbackHandler<T> handler)

Registers a callback handler to be executed when a given PendingIntent is fired for a RemoteCallback.

static RemoteCallback stubToRemoteCallback(CallbackReceiver receiver, Class<? extends CallbackReceiver> cls, Bundle args, String method)

Turns a callback receiver stub into a remote callback.

Inherited methods

Public constructors

CallbackHandlerRegistry

public CallbackHandlerRegistry ()

Public methods

invokeCallback

public void invokeCallback (Context context, 
                T receiver, 
                Intent intent)

Trigger a call to a callback using arguments that were generated with RemoteCallback.getArgumentBundle().

Parameters
context Context

receiver T

intent Intent

invokeCallback

public void invokeCallback (Context context, 
                T receiver, 
                Bundle bundle)

Trigger a call to a callback using arguments that were generated with RemoteCallback.getArgumentBundle().

Parameters
context Context

receiver T

bundle Bundle

registerCallbackHandler

public static void registerCallbackHandler (Class<T> cls, 
                String method, 
                CallbackHandler<T> handler)

Registers a callback handler to be executed when a given PendingIntent is fired for a RemoteCallback. Note: This should only be called by generated code, there is no reason to reference this otherwise.

Parameters
cls Class

method String

handler CallbackHandler

stubToRemoteCallback

public static RemoteCallback stubToRemoteCallback (CallbackReceiver receiver, 
                Class<? extends CallbackReceiver> cls, 
                Bundle args, 
                String method)

Turns a callback receiver stub into a remote callback. Note: This should only be called by generated code, there is no reason to reference this otherwise.

Parameters
receiver CallbackReceiver

cls Class

args Bundle

method String

Returns
RemoteCallback