# AppWidgetProviderWithCallbacks

Artifact: [androidx.remotecallback:remotecallback](https://developer.android.com/jetpack/androidx/releases/remotecallback) [View Source](https://cs.android.com/search?q=file:androidx/remotecallback/AppWidgetProviderWithCallbacks.java+class:androidx.remotecallback.AppWidgetProviderWithCallbacks) 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 class AppWidgetProviderWithCallbacks<T extends CallbackReceiver> extends AppWidgetProvider implements CallbackReceiver<T>
```

<br />

|---|---|---|---|
| [java.lang.Object](https://developer.android.com/reference/java/lang/Object.html) ||||
| ↳ | [android.content.BroadcastReceiver](https://developer.android.com/reference/android/content/BroadcastReceiver.html) |||
|   | ↳ | [android.appwidget.AppWidgetProvider](https://developer.android.com/reference/android/appwidget/AppWidgetProvider.html) ||
|   |   | ↳ | [androidx.remotecallback.AppWidgetProviderWithCallbacks](https://developer.android.com/reference/androidx/remotecallback/AppWidgetProviderWithCallbacks) |

*** ** * ** ***

> [!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 `https://developer.android.com/reference/android/appwidget/AppWidgetProvider.html` that implements a `https://developer.android.com/reference/androidx/remotecallback/CallbackReceiver`.

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

## Summary

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

| ### Public methods |
|---|---|
| `@https://jspecify.dev/docs/api/org/jspecify/annotations/NonNull.html T` | `[createRemoteCallback](https://developer.android.com/reference/androidx/remotecallback/AppWidgetProviderWithCallbacks#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 |
| `void` | `[onReceive](https://developer.android.com/reference/androidx/remotecallback/AppWidgetProviderWithCallbacks#onReceive(android.content.Context,android.content.Intent))(https://developer.android.com/reference/android/content/Context.html context, https://developer.android.com/reference/android/content/Intent.html intent)` **This method is deprecated.** Deprecated in Java |

### Inherited methods

From [android.appwidget.AppWidgetProvider](https://developer.android.com/reference/android/appwidget/AppWidgetProvider.html) `void` `[onAppWidgetOptionsChanged](https://developer.android.com/reference/android/appwidget/AppWidgetProvider.html#onAppWidgetOptionsChanged(android.content.Context, android.appwidget.AppWidgetManager, int, android.os.Bundle))(
https://developer.android.com/reference/android/content/Context.html context,
https://developer.android.com/reference/android/appwidget/AppWidgetManager.html appWidgetManager,
int appWidgetId,
https://developer.android.com/reference/android/os/Bundle.html newOptions
)`

**This method is deprecated.** Deprecated in Java
`void` `[onDeleted](https://developer.android.com/reference/android/appwidget/AppWidgetProvider.html#onDeleted(android.content.Context, int[]))(https://developer.android.com/reference/android/content/Context.html context, int[] appWidgetIds)`

**This method is deprecated.** Deprecated in Java
`void` `[onDisabled](https://developer.android.com/reference/android/appwidget/AppWidgetProvider.html#onDisabled(android.content.Context))(https://developer.android.com/reference/android/content/Context.html context)`

**This method is deprecated.** Deprecated in Java
`void` `[onEnabled](https://developer.android.com/reference/android/appwidget/AppWidgetProvider.html#onEnabled(android.content.Context))(https://developer.android.com/reference/android/content/Context.html context)`

**This method is deprecated.** Deprecated in Java
`void` `[onRestored](https://developer.android.com/reference/android/appwidget/AppWidgetProvider.html#onRestored(android.content.Context, int[], int[]))(https://developer.android.com/reference/android/content/Context.html context, int[] oldWidgetIds, int[] newWidgetIds)`

**This method is deprecated.** Deprecated in Java
`void` `[onUpdate](https://developer.android.com/reference/android/appwidget/AppWidgetProvider.html#onUpdate(android.content.Context, android.appwidget.AppWidgetManager, int[]))(
https://developer.android.com/reference/android/content/Context.html context,
https://developer.android.com/reference/android/appwidget/AppWidgetManager.html appWidgetManager,
int[] appWidgetIds
)`

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

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

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

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

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

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

**This method is deprecated.** Deprecated in Java
`final https://developer.android.com/reference/android/os/Bundle.html` `[getResultExtras](https://developer.android.com/reference/android/content/BroadcastReceiver.html#getResultExtras(boolean))(boolean makeMap)`

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

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

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

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

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

**This method is deprecated.** Deprecated in Java
`https://developer.android.com/reference/android/os/IBinder.html` `[peekService](https://developer.android.com/reference/android/content/BroadcastReceiver.html#peekService(android.content.Context, android.content.Intent))(https://developer.android.com/reference/android/content/Context.html myContext, https://developer.android.com/reference/android/content/Intent.html service)`

**This method is deprecated.** Deprecated in Java
`final void` `[setDebugUnregister](https://developer.android.com/reference/android/content/BroadcastReceiver.html#setDebugUnregister(boolean))(boolean debug)`

**This method is deprecated.** Deprecated in Java
`final void` `[setOrderedHint](https://developer.android.com/reference/android/content/BroadcastReceiver.html#setOrderedHint(boolean))(boolean isOrdered)`

**This method is deprecated.** Deprecated in Java
`final void` `[setResult](https://developer.android.com/reference/android/content/BroadcastReceiver.html#setResult(int, java.lang.String, android.os.Bundle))(int code, https://developer.android.com/reference/java/lang/String.html data, https://developer.android.com/reference/android/os/Bundle.html extras)`

**This method is deprecated.** Deprecated in Java
`final void` `[setResultCode](https://developer.android.com/reference/android/content/BroadcastReceiver.html#setResultCode(int))(int code)`

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

**This method is deprecated.** Deprecated in Java
`final void` `[setResultExtras](https://developer.android.com/reference/android/content/BroadcastReceiver.html#setResultExtras(android.os.Bundle))(https://developer.android.com/reference/android/os/Bundle.html extras)`

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

## Public constructors

### AppWidgetProviderWithCallbacks

Added in 1.0.0-alpha03 Deprecated in 1.0.0-alpha03

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

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

## Public methods

### createRemoteCallback

```
public @NonNull T [createRemoteCallback](https://developer.android.com/reference/androidx/remotecallback/AppWidgetProviderWithCallbacks#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;
    }
```

### onReceive

```
public void [onReceive](https://developer.android.com/reference/androidx/remotecallback/AppWidgetProviderWithCallbacks#onReceive(android.content.Context,android.content.Intent))(Context context, Intent intent)
```

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