# ContentProviderWithCallbacks

Artifact: [androidx.remotecallback:remotecallback](https://developer.android.com/jetpack/androidx/releases/remotecallback) [View Source](https://cs.android.com/search?q=file:androidx/remotecallback/ContentProviderWithCallbacks.java+class:androidx.remotecallback.ContentProviderWithCallbacks) Added in [1.0.0-alpha03](https://developer.android.com/jetpack/androidx/releases/remotecallback#1.0.0-alpha03) Deprecated in [1.0.0-alpha03](https://developer.android.com/jetpack/androidx/releases/remotecallback#1.0.0-alpha03)

*** ** * ** ***


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

<br />

|---|---|---|
| [java.lang.Object](https://developer.android.com/reference/java/lang/Object.html) |||
| ↳ | [android.content.ContentProvider](https://developer.android.com/reference/android/content/ContentProvider.html) ||
|   | ↳ | [androidx.remotecallback.ContentProviderWithCallbacks](https://developer.android.com/reference/androidx/remotecallback/ContentProviderWithCallbacks) |

*** ** * ** ***

> [!CAUTION]
> **This class is deprecated.**   
>
> Slice framework has been deprecated, it will not receive any updates moving forward. If you are looking for a framework that handles communication across apps, consider using `https://developer.android.com/reference/android/app/appsearch/AppSearchManager.html`.

Version of ContentProvider that can be used as a `https://developer.android.com/reference/androidx/remotecallback/CallbackReceiver`. Be sure to call the super of `https://developer.android.com/reference/androidx/remotecallback/ContentProviderWithCallbacks#call(java.lang.String,java.lang.String,android.os.Bundle)` when unhandled to ensure callbacks are triggered.

| Parameters |
|---|---|
| `<T extends https://developer.android.com/reference/androidx/remotecallback/ContentProviderWithCallbacks>` | Should be specified as the root class (e.g. class X extends ContentProviderWithCallbacks\\) |

## Summary

| ### Public constructors |
|---|
| `[ContentProviderWithCallbacks](https://developer.android.com/reference/androidx/remotecallback/ContentProviderWithCallbacks#ContentProviderWithCallbacks())()` **This method is deprecated.** Deprecated in Java |

| ### Public methods |
|---|---|
| `void` | `[attachInfo](https://developer.android.com/reference/androidx/remotecallback/ContentProviderWithCallbacks#attachInfo(android.content.Context,android.content.pm.ProviderInfo))(https://developer.android.com/reference/android/content/Context.html context, https://developer.android.com/reference/android/content/pm/ProviderInfo.html info)` **This method is deprecated.** Deprecated in Java |
| `@https://jspecify.dev/docs/api/org/jspecify/annotations/Nullable.html https://developer.android.com/reference/android/os/Bundle.html` | `[call](https://developer.android.com/reference/androidx/remotecallback/ContentProviderWithCallbacks#call(java.lang.String,java.lang.String,android.os.Bundle))(@https://jspecify.dev/docs/api/org/jspecify/annotations/NonNull.html https://developer.android.com/reference/java/lang/String.html method, @https://jspecify.dev/docs/api/org/jspecify/annotations/Nullable.html https://developer.android.com/reference/java/lang/String.html arg, @https://jspecify.dev/docs/api/org/jspecify/annotations/Nullable.html https://developer.android.com/reference/android/os/Bundle.html extras)` **This method is deprecated.** Deprecated in Java |
| `@https://jspecify.dev/docs/api/org/jspecify/annotations/NonNull.html T` | `[createRemoteCallback](https://developer.android.com/reference/androidx/remotecallback/ContentProviderWithCallbacks#createRemoteCallback(android.content.Context))(@https://jspecify.dev/docs/api/org/jspecify/annotations/NonNull.html https://developer.android.com/reference/android/content/Context.html context)` **This method is deprecated.** Deprecated in Java |

### Inherited Constants

From [android.content.ComponentCallbacks2](https://developer.android.com/reference/android/content/ComponentCallbacks2.html) `static final int` `https://developer.android.com/reference/android/content/ComponentCallbacks2.html#TRIM_MEMORY_BACKGROUND = 40`

**This field is deprecated.** Deprecated in Java
`static final int` `https://developer.android.com/reference/android/content/ComponentCallbacks2.html#TRIM_MEMORY_COMPLETE = 80`

**This field is deprecated.**
`static final int` `https://developer.android.com/reference/android/content/ComponentCallbacks2.html#TRIM_MEMORY_MODERATE = 60`

**This field is deprecated.**
`static final int` `https://developer.android.com/reference/android/content/ComponentCallbacks2.html#TRIM_MEMORY_RUNNING_CRITICAL = 15`

**This field is deprecated.**
`static final int` `https://developer.android.com/reference/android/content/ComponentCallbacks2.html#TRIM_MEMORY_RUNNING_LOW = 10`

**This field is deprecated.**
`static final int` `https://developer.android.com/reference/android/content/ComponentCallbacks2.html#TRIM_MEMORY_RUNNING_MODERATE = 5`

**This field is deprecated.**
`static final int` `https://developer.android.com/reference/android/content/ComponentCallbacks2.html#TRIM_MEMORY_UI_HIDDEN = 20`

**This field is deprecated.** Deprecated in Java

### Inherited methods

From [android.content.ContentProvider](https://developer.android.com/reference/android/content/ContentProvider.html) `ContentProviderResult[]` `[applyBatch](https://developer.android.com/reference/android/content/ContentProvider.html#applyBatch(java.lang.String, java.util.ArrayList&lt;android.content.ContentProviderOperation&gt;))(
https://developer.android.com/reference/java/lang/String.html authority,
https://developer.android.com/reference/java/util/ArrayList.html<https://developer.android.com/reference/android/content/ContentProviderOperation.html> operations
)`

**This method is deprecated.** Deprecated in Java
`int` `[bulkInsert](https://developer.android.com/reference/android/content/ContentProvider.html#bulkInsert(android.net.Uri, android.content.ContentValues[]))(https://developer.android.com/reference/android/net/Uri.html uri, ContentValues[] values)`

**This method is deprecated.** Deprecated in Java
`https://developer.android.com/reference/android/net/Uri.html` `[canonicalize](https://developer.android.com/reference/android/content/ContentProvider.html#canonicalize(android.net.Uri))(https://developer.android.com/reference/android/net/Uri.html url)`

**This method is deprecated.** Deprecated in Java
`final https://developer.android.com/reference/android/content/ContentProvider.CallingIdentity.html` `[clearCallingIdentity](https://developer.android.com/reference/android/content/ContentProvider.html#clearCallingIdentity())()`

**This method is deprecated.** Deprecated in Java
`int` `[delete](https://developer.android.com/reference/android/content/ContentProvider.html#delete(android.net.Uri, android.os.Bundle))(https://developer.android.com/reference/android/net/Uri.html uri, https://developer.android.com/reference/android/os/Bundle.html extras)`

**This method is deprecated.** Deprecated in Java
`void` `[dump](https://developer.android.com/reference/android/content/ContentProvider.html#dump(java.io.FileDescriptor, java.io.PrintWriter, java.lang.String[]))(https://developer.android.com/reference/java/io/FileDescriptor.html fd, https://developer.android.com/reference/java/io/PrintWriter.html writer, String[] args)`

**This method is deprecated.** Deprecated in Java
`final https://developer.android.com/reference/android/content/AttributionSource.html` `[getCallingAttributionSource](https://developer.android.com/reference/android/content/ContentProvider.html#getCallingAttributionSource())()`

**This method is deprecated.** Deprecated in Java
`final https://developer.android.com/reference/java/lang/String.html` `[getCallingAttributionTag](https://developer.android.com/reference/android/content/ContentProvider.html#getCallingAttributionTag())()`

**This method is deprecated.** Deprecated in Java
`final https://developer.android.com/reference/java/lang/String.html` `[getCallingPackage](https://developer.android.com/reference/android/content/ContentProvider.html#getCallingPackage())()`

**This method is deprecated.** Deprecated in Java
`final https://developer.android.com/reference/java/lang/String.html` `[getCallingPackageUnchecked](https://developer.android.com/reference/android/content/ContentProvider.html#getCallingPackageUnchecked())()`

**This method is deprecated.** Deprecated in Java
`final https://developer.android.com/reference/android/content/Context.html` `[getContext](https://developer.android.com/reference/android/content/ContentProvider.html#getContext())()`

**This method is deprecated.** Deprecated in Java
`final PathPermission[]` `[getPathPermissions](https://developer.android.com/reference/android/content/ContentProvider.html#getPathPermissions())()`

**This method is deprecated.** Deprecated in Java
`final https://developer.android.com/reference/java/lang/String.html` `[getReadPermission](https://developer.android.com/reference/android/content/ContentProvider.html#getReadPermission())()`

**This method is deprecated.** Deprecated in Java
`String[]` `[getStreamTypes](https://developer.android.com/reference/android/content/ContentProvider.html#getStreamTypes(android.net.Uri, java.lang.String))(https://developer.android.com/reference/android/net/Uri.html uri, https://developer.android.com/reference/java/lang/String.html mimeTypeFilter)`

**This method is deprecated.** Deprecated in Java
`abstract https://developer.android.com/reference/java/lang/String.html` `[getType](https://developer.android.com/reference/android/content/ContentProvider.html#getType(android.net.Uri))(https://developer.android.com/reference/android/net/Uri.html p)`

**This method is deprecated.** Deprecated in Java
`https://developer.android.com/reference/java/lang/String.html` `[getTypeAnonymous](https://developer.android.com/reference/android/content/ContentProvider.html#getTypeAnonymous(android.net.Uri))(https://developer.android.com/reference/android/net/Uri.html uri)`

**This method is deprecated.** Deprecated in Java
`final https://developer.android.com/reference/java/lang/String.html` `[getWritePermission](https://developer.android.com/reference/android/content/ContentProvider.html#getWritePermission())()`

**This method is deprecated.** Deprecated in Java
`abstract https://developer.android.com/reference/android/net/Uri.html` `[insert](https://developer.android.com/reference/android/content/ContentProvider.html#insert(android.net.Uri, android.content.ContentValues))(https://developer.android.com/reference/android/net/Uri.html p, https://developer.android.com/reference/android/content/ContentValues.html p1)`

**This method is deprecated.** Deprecated in Java
`boolean` `[isTemporary](https://developer.android.com/reference/android/content/ContentProvider.html#isTemporary())()`

**This method is deprecated.** Deprecated in Java
`void` `[onCallingPackageChanged](https://developer.android.com/reference/android/content/ContentProvider.html#onCallingPackageChanged())()`

**This method is deprecated.** Deprecated in Java
`void` `[onConfigurationChanged](https://developer.android.com/reference/android/content/ContentProvider.html#onConfigurationChanged(android.content.res.Configuration))(https://developer.android.com/reference/android/content/res/Configuration.html newConfig)`

**This method is deprecated.** Deprecated in Java
`abstract boolean` `[onCreate](https://developer.android.com/reference/android/content/ContentProvider.html#onCreate())()`

**This method is deprecated.** Deprecated in Java
`void` `[onLowMemory](https://developer.android.com/reference/android/content/ContentProvider.html#onLowMemory())()`

**This method is deprecated.**
`void` `[onTrimMemory](https://developer.android.com/reference/android/content/ContentProvider.html#onTrimMemory(int))(int level)`

**This method is deprecated.** Deprecated in Java
`https://developer.android.com/reference/android/content/res/AssetFileDescriptor.html` `[openAssetFile](https://developer.android.com/reference/android/content/ContentProvider.html#openAssetFile(android.net.Uri, java.lang.String))(https://developer.android.com/reference/android/net/Uri.html uri, https://developer.android.com/reference/java/lang/String.html mode)`

**This method is deprecated.** Deprecated in Java
`https://developer.android.com/reference/android/os/ParcelFileDescriptor.html` `[openFile](https://developer.android.com/reference/android/content/ContentProvider.html#openFile(android.net.Uri, java.lang.String))(https://developer.android.com/reference/android/net/Uri.html uri, https://developer.android.com/reference/java/lang/String.html mode)`

**This method is deprecated.** Deprecated in Java
`final https://developer.android.com/reference/android/os/ParcelFileDescriptor.html` `[openFileHelper](https://developer.android.com/reference/android/content/ContentProvider.html#openFileHelper(android.net.Uri, java.lang.String))(https://developer.android.com/reference/android/net/Uri.html uri, https://developer.android.com/reference/java/lang/String.html mode)`

**This method is deprecated.** Deprecated in Java
`https://developer.android.com/reference/android/os/ParcelFileDescriptor.html` `<T> [openPipeHelper](https://developer.android.com/reference/android/content/ContentProvider.html#openPipeHelper(android.net.Uri, java.lang.String, android.os.Bundle, T, android.content.ContentProvider.PipeDataWriter&lt;T&gt;))(
https://developer.android.com/reference/android/net/Uri.html uri,
https://developer.android.com/reference/java/lang/String.html mimeType,
https://developer.android.com/reference/android/os/Bundle.html opts,
T args,
https://developer.android.com/reference/android/content/ContentProvider.PipeDataWriter.html<T> func
)`

**This method is deprecated.** Deprecated in Java
`https://developer.android.com/reference/android/content/res/AssetFileDescriptor.html` `[openTypedAssetFile](https://developer.android.com/reference/android/content/ContentProvider.html#openTypedAssetFile(android.net.Uri, java.lang.String, android.os.Bundle))(https://developer.android.com/reference/android/net/Uri.html uri, https://developer.android.com/reference/java/lang/String.html mimeTypeFilter, https://developer.android.com/reference/android/os/Bundle.html opts)`

**This method is deprecated.** Deprecated in Java
`https://developer.android.com/reference/android/database/Cursor.html` `[query](https://developer.android.com/reference/android/content/ContentProvider.html#query(android.net.Uri, java.lang.String[], android.os.Bundle, android.os.CancellationSignal))(
https://developer.android.com/reference/android/net/Uri.html uri,
String[] projection,
https://developer.android.com/reference/android/os/Bundle.html queryArgs,
https://developer.android.com/reference/android/os/CancellationSignal.html cancellationSignal
)`

**This method is deprecated.** Deprecated in Java
`boolean` `[refresh](https://developer.android.com/reference/android/content/ContentProvider.html#refresh(android.net.Uri, android.os.Bundle, android.os.CancellationSignal))(https://developer.android.com/reference/android/net/Uri.html uri, https://developer.android.com/reference/android/os/Bundle.html extras, https://developer.android.com/reference/android/os/CancellationSignal.html cancellationSignal)`

**This method is deprecated.** Deprecated in Java
`final https://developer.android.com/reference/android/content/Context.html` `[requireContext](https://developer.android.com/reference/android/content/ContentProvider.html#requireContext())()`

**This method is deprecated.** Deprecated in Java
`final void` `[restoreCallingIdentity](https://developer.android.com/reference/android/content/ContentProvider.html#restoreCallingIdentity(android.content.ContentProvider.CallingIdentity))(https://developer.android.com/reference/android/content/ContentProvider.CallingIdentity.html identity)`

**This method is deprecated.** Deprecated in Java
`final void` `[setPathPermissions](https://developer.android.com/reference/android/content/ContentProvider.html#setPathPermissions(android.content.pm.PathPermission[]))(PathPermission[] permissions)`

**This method is deprecated.** Deprecated in Java
`final void` `[setReadPermission](https://developer.android.com/reference/android/content/ContentProvider.html#setReadPermission(java.lang.String))(https://developer.android.com/reference/java/lang/String.html permission)`

**This method is deprecated.** Deprecated in Java
`final void` `[setWritePermission](https://developer.android.com/reference/android/content/ContentProvider.html#setWritePermission(java.lang.String))(https://developer.android.com/reference/java/lang/String.html permission)`

**This method is deprecated.** Deprecated in Java
`void` `[shutdown](https://developer.android.com/reference/android/content/ContentProvider.html#shutdown())()`

**This method is deprecated.** Deprecated in Java
`https://developer.android.com/reference/android/net/Uri.html` `[uncanonicalize](https://developer.android.com/reference/android/content/ContentProvider.html#uncanonicalize(android.net.Uri))(https://developer.android.com/reference/android/net/Uri.html url)`

**This method is deprecated.** Deprecated in Java
`int` `[update](https://developer.android.com/reference/android/content/ContentProvider.html#update(android.net.Uri, android.content.ContentValues, android.os.Bundle))(https://developer.android.com/reference/android/net/Uri.html uri, https://developer.android.com/reference/android/content/ContentValues.html values, https://developer.android.com/reference/android/os/Bundle.html extras)`

**This method is deprecated.** Deprecated in Java

## Public constructors

### ContentProviderWithCallbacks

Added in 1.0.0-alpha03 Deprecated in 1.0.0-alpha03

```
public [ContentProviderWithCallbacks](https://developer.android.com/reference/androidx/remotecallback/ContentProviderWithCallbacks#ContentProviderWithCallbacks())()
```

> [!CAUTION]
> **This method is deprecated.**   
> Deprecated in Java

## Public methods

### attachInfo

```
public void [attachInfo](https://developer.android.com/reference/androidx/remotecallback/ContentProviderWithCallbacks#attachInfo(android.content.Context,android.content.pm.ProviderInfo))(Context context, ProviderInfo info)
```

> [!CAUTION]
> **This method is deprecated.**   
> Deprecated in Java

### call

```
public @Nullable Bundle [call](https://developer.android.com/reference/androidx/remotecallback/ContentProviderWithCallbacks#call(java.lang.String,java.lang.String,android.os.Bundle))(@NonNull String method, @Nullable String arg, @Nullable Bundle extras)
```

> [!CAUTION]
> **This method is deprecated.**   
> Deprecated in Java

### createRemoteCallback

```
public @NonNull T [createRemoteCallback](https://developer.android.com/reference/androidx/remotecallback/ContentProviderWithCallbacks#createRemoteCallback(android.content.Context))(@NonNull Context context)
```

> [!CAUTION]
> **This method is deprecated.**   
> Deprecated in Java

Creates a `https://developer.android.com/reference/androidx/remotecallback/RemoteCallback` that will call the method with method specified with the arguments specified when triggered. Only methods tagged with `https://developer.android.com/reference/androidx/remotecallback/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 `https://developer.android.com/reference/androidx/remotecallback/RemoteCallable`.

```
    createRemoteCallback().callMyMethod("My arguments", 43, 2.4)
             .toPendingIntent(context);
```

```
    \@RemoteCallable
    public RemoteCallback callMyMethod(String argStr, int argInt, double argDouble) {
        ...
        return RemoteCallback.LOCAL;
    }
```