# 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)

*** ** * ** ***


```
class AppWidgetProviderWithCallbacks<T : CallbackReceiver?> : AppWidgetProvider, CallbackReceiver<T!>
```

<br />

|---|---|---|---|
| [kotlin.Any](https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-any/index.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/kotlin/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/kotlin/androidx/remotecallback/CallbackReceiver`.

| Parameters |
|---|---|
| `<T : https://developer.android.com/reference/kotlin/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/kotlin/androidx/remotecallback/AppWidgetProviderWithCallbacks#AppWidgetProviderWithCallbacks())()` **This function is deprecated.** Deprecated in Java |

| ### Public functions |
|---|---|
| `T` | `[createRemoteCallback](https://developer.android.com/reference/kotlin/androidx/remotecallback/AppWidgetProviderWithCallbacks#createRemoteCallback(android.content.Context))(context: https://developer.android.com/reference/android/content/Context.html)` **This function is deprecated.** Deprecated in Java |
| `https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-unit/index.html` | `[onReceive](https://developer.android.com/reference/kotlin/androidx/remotecallback/AppWidgetProviderWithCallbacks#onReceive(android.content.Context,android.content.Intent))(context: https://developer.android.com/reference/android/content/Context.html!, intent: https://developer.android.com/reference/android/content/Intent.html!)` **This function is deprecated.** Deprecated in Java |

### Inherited functions

From [android.appwidget.AppWidgetProvider](https://developer.android.com/reference/android/appwidget/AppWidgetProvider.html) `https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-unit/index.html` `[onAppWidgetOptionsChanged](https://developer.android.com/reference/android/appwidget/AppWidgetProvider.html#onAppWidgetOptionsChanged(android.content.Context, android.appwidget.AppWidgetManager, int, android.os.Bundle))(
context: https://developer.android.com/reference/android/content/Context.html!,
appWidgetManager: https://developer.android.com/reference/android/appwidget/AppWidgetManager.html!,
appWidgetId: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html,
newOptions: https://developer.android.com/reference/android/os/Bundle.html!
)`

**This function is deprecated.** Deprecated in Java
`https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-unit/index.html` `[onDeleted](https://developer.android.com/reference/android/appwidget/AppWidgetProvider.html#onDeleted(android.content.Context, int[]))(context: https://developer.android.com/reference/android/content/Context.html!, appWidgetIds: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int-array/index.html<https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html>!)`

**This function is deprecated.** Deprecated in Java
`https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-unit/index.html` `[onDisabled](https://developer.android.com/reference/android/appwidget/AppWidgetProvider.html#onDisabled(android.content.Context))(context: https://developer.android.com/reference/android/content/Context.html!)`

**This function is deprecated.** Deprecated in Java
`https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-unit/index.html` `[onEnabled](https://developer.android.com/reference/android/appwidget/AppWidgetProvider.html#onEnabled(android.content.Context))(context: https://developer.android.com/reference/android/content/Context.html!)`

**This function is deprecated.** Deprecated in Java
`https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-unit/index.html` `[onRestored](https://developer.android.com/reference/android/appwidget/AppWidgetProvider.html#onRestored(android.content.Context, int[], int[]))(
context: https://developer.android.com/reference/android/content/Context.html!,
oldWidgetIds: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int-array/index.html<https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html>!,
newWidgetIds: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int-array/index.html<https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html>!
)`

**This function is deprecated.** Deprecated in Java
`https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-unit/index.html` `[onUpdate](https://developer.android.com/reference/android/appwidget/AppWidgetProvider.html#onUpdate(android.content.Context, android.appwidget.AppWidgetManager, int[]))(
context: https://developer.android.com/reference/android/content/Context.html!,
appWidgetManager: https://developer.android.com/reference/android/appwidget/AppWidgetManager.html!,
appWidgetIds: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int-array/index.html<https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html>!
)`

**This function is deprecated.** Deprecated in Java
From [android.content.BroadcastReceiver](https://developer.android.com/reference/android/content/BroadcastReceiver.html) `https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-unit/index.html` `[abortBroadcast](https://developer.android.com/reference/android/content/BroadcastReceiver.html#abortBroadcast())()`

**This function is deprecated.** Deprecated in Java
`https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-unit/index.html` `[clearAbortBroadcast](https://developer.android.com/reference/android/content/BroadcastReceiver.html#clearAbortBroadcast())()`

**This function is deprecated.** Deprecated in Java
`https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-boolean/index.html` `[getAbortBroadcast](https://developer.android.com/reference/android/content/BroadcastReceiver.html#getAbortBroadcast())()`

**This function is deprecated.** Deprecated in Java
`https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-boolean/index.html` `[getDebugUnregister](https://developer.android.com/reference/android/content/BroadcastReceiver.html#getDebugUnregister())()`

**This function is deprecated.** Deprecated in Java
`https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html` `[getResultCode](https://developer.android.com/reference/android/content/BroadcastReceiver.html#getResultCode())()`

**This function is deprecated.** Deprecated in Java
`https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-string/index.html!` `[getResultData](https://developer.android.com/reference/android/content/BroadcastReceiver.html#getResultData())()`

**This function is deprecated.** Deprecated in Java
`https://developer.android.com/reference/android/os/Bundle.html!` `[getResultExtras](https://developer.android.com/reference/android/content/BroadcastReceiver.html#getResultExtras(boolean))(makeMap: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-boolean/index.html)`

**This function is deprecated.** Deprecated in Java
`https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-string/index.html!` `[getSentFromPackage](https://developer.android.com/reference/android/content/BroadcastReceiver.html#getSentFromPackage())()`

**This function is deprecated.** Deprecated in Java
`https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html` `[getSentFromUid](https://developer.android.com/reference/android/content/BroadcastReceiver.html#getSentFromUid())()`

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

**This function is deprecated.** Deprecated in Java
`https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-boolean/index.html` `[isInitialStickyBroadcast](https://developer.android.com/reference/android/content/BroadcastReceiver.html#isInitialStickyBroadcast())()`

**This function is deprecated.** Deprecated in Java
`https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-boolean/index.html` `[isOrderedBroadcast](https://developer.android.com/reference/android/content/BroadcastReceiver.html#isOrderedBroadcast())()`

**This function 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))(myContext: https://developer.android.com/reference/android/content/Context.html!, service: https://developer.android.com/reference/android/content/Intent.html!)`

**This function is deprecated.** Deprecated in Java
`https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-unit/index.html` `[setDebugUnregister](https://developer.android.com/reference/android/content/BroadcastReceiver.html#setDebugUnregister(boolean))(debug: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-boolean/index.html)`

**This function is deprecated.** Deprecated in Java
`https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-unit/index.html` `[setOrderedHint](https://developer.android.com/reference/android/content/BroadcastReceiver.html#setOrderedHint(boolean))(isOrdered: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-boolean/index.html)`

**This function is deprecated.** Deprecated in Java
`https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-unit/index.html` `[setResult](https://developer.android.com/reference/android/content/BroadcastReceiver.html#setResult(int, java.lang.String, android.os.Bundle))(code: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html, data: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-string/index.html!, extras: https://developer.android.com/reference/android/os/Bundle.html!)`

**This function is deprecated.** Deprecated in Java
`https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-unit/index.html` `[setResultCode](https://developer.android.com/reference/android/content/BroadcastReceiver.html#setResultCode(int))(code: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html)`

**This function is deprecated.** Deprecated in Java
`https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-unit/index.html` `[setResultData](https://developer.android.com/reference/android/content/BroadcastReceiver.html#setResultData(java.lang.String))(data: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-string/index.html!)`

**This function is deprecated.** Deprecated in Java
`https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-unit/index.html` `[setResultExtras](https://developer.android.com/reference/android/content/BroadcastReceiver.html#setResultExtras(android.os.Bundle))(extras: https://developer.android.com/reference/android/os/Bundle.html!)`

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

## Public constructors

### AppWidgetProviderWithCallbacks

Added in 1.0.0-alpha03 Deprecated in 1.0.0-alpha03

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

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

## Public functions

### createRemoteCallback

```
fun [createRemoteCallback](https://developer.android.com/reference/kotlin/androidx/remotecallback/AppWidgetProviderWithCallbacks#createRemoteCallback(android.content.Context))(context: Context): T
```

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

Creates a `https://developer.android.com/reference/kotlin/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/kotlin/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/kotlin/androidx/remotecallback/RemoteCallable`.

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

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

### onReceive

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

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