BroadcastReceiverWithCallbacks
public
abstract
class
BroadcastReceiverWithCallbacks
extends BroadcastReceiver
implements
CallbackReceiver<T extends CallbackReceiver>
java.lang.Object | ||
↳ | android.content.BroadcastReceiver | |
↳ | androidx.remotecallback.BroadcastReceiverWithCallbacks<T extends androidx.remotecallback.CallbackReceiver> |
Extend this broadcast receiver to be able to receive callbacks
as well as normal broadcasts. Ensure that you call the super of
onReceive(Context, Intent)
when the action is ACTION_BROADCAST_CALLBACK
.
Summary
Constants | |
---|---|
String |
ACTION_BROADCAST_CALLBACK
The action used for incoming RemoteCallbacks. |
Public constructors | |
---|---|
BroadcastReceiverWithCallbacks()
|
Public methods | |
---|---|
T
|
createRemoteCallback(Context context)
Creates a |
void
|
onReceive(Context context, Intent intent)
|
Inherited methods | |
---|---|
Constants
ACTION_BROADCAST_CALLBACK
public static final String ACTION_BROADCAST_CALLBACK
The action used for incoming RemoteCallbacks.
Constant Value: "androidx.remotecallback.action.BROADCAST_CALLBACK"
Public constructors
BroadcastReceiverWithCallbacks
public BroadcastReceiverWithCallbacks ()
Public methods
createRemoteCallback
public T createRemoteCallback (Context context)
Creates a RemoteCallback
that will call the method with method
specified with the arguments specified when triggered. Only methods
tagged with RemoteCallable
can be used here.
This method returns a stub implementation of the class calling it to
record the arguments/method being used. This should only be used in a
chain of 2 calls, starting with createRemoteCallback(), then followed
up with a call to any method tagged with RemoteCallable
.
createRemoteCallback().callMyMethod("My arguments", 43, 2.4) .toPendingIntent(context);
\@RemoteCallable public RemoteCallback callMyMethod(String argStr, int argInt, double argDouble) { ... return RemoteCallback.LOCAL; }
Parameters | |
---|---|
context |
Context |
Returns | |
---|---|
T |