The Android Developer Challenge is back! Submit your idea before December 2.

ContentProviderWithCallbacks

public abstract class ContentProviderWithCallbacks
extends ContentProvider implements CallbackReceiver<T extends ContentProviderWithCallbacks>

java.lang.Object
   ↳ android.content.ContentProvider
     ↳ androidx.remotecallback.ContentProviderWithCallbacks<T extends androidx.remotecallback.ContentProviderWithCallbacks>


Version of ContentProvider that can be used as a CallbackReceiver. Be sure to call the super of call(String, String, Bundle) when unhandled to ensure callbacks are triggered.

Summary

Inherited constants

Public constructors

ContentProviderWithCallbacks()

Public methods

void attachInfo(Context context, ProviderInfo info)
Bundle call(String method, String arg, Bundle extras)
T createRemoteCallback(Context context)

Creates a RemoteCallback that will call the method with method specified with the arguments specified when triggered.

Inherited methods

Public constructors

ContentProviderWithCallbacks

public ContentProviderWithCallbacks ()

Public methods

attachInfo

public void attachInfo (Context context, 
                ProviderInfo info)

Parameters
context Context

info ProviderInfo

call

public Bundle call (String method, 
                String arg, 
                Bundle extras)

Parameters
method String

arg String

extras Bundle

Returns
Bundle

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