# AppUpdateManager

Summary:[Methods](https://developer.android.com/reference/com/google/android/play/core/appupdate/AppUpdateManager#pubmethods)  

# AppUpdateManager

`
public


interface
AppUpdateManager
`  
`


`

|---------------------------------------------------------|
| com.google.android.play.core.appupdate.AppUpdateManager |

|------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
| Known indirect subclasses [FakeAppUpdateManager](https://developer.android.com/reference/com/google/android/play/core/appupdate/testing/FakeAppUpdateManager.html) |------------------------------------------------------------------------------------------------------------------------------------------|-------------------------------------------------------------------------------------------------------------------------------------------------------| | [FakeAppUpdateManager](https://developer.android.com/reference/com/google/android/play/core/appupdate/testing/FakeAppUpdateManager.html) | A fake implementation of the[AppUpdateManager](https://developer.android.com/reference/com/google/android/play/core/appupdate/AppUpdateManager.html). | |

<br />

*** ** * ** ***

Manages operations that allow your app to initiate its own updates.

For more information, read[Support in-app updates](https://d.android.com/guide/app-bundle/in-app-updates).

## Summary

|                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                          ### Public methods                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                          ||
|-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
| ` abstract `[Task](https://developer.google.com/android/reference/com/google/android/gms/tasks/Task.html)`<`[Void](https://developer.android.com/reference/java/lang/Void.html)`>`                                                | ` `[completeUpdate](https://developer.android.com/reference/com/google/android/play/core/appupdate/AppUpdateManager.html#completeUpdate())`() ` For a flexible update flow, triggers the completion of the update.                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                |
| ` abstract `[Task](https://developer.google.com/android/reference/com/google/android/gms/tasks/Task.html)`<`[AppUpdateInfo](https://developer.android.com/reference/com/google/android/play/core/appupdate/AppUpdateInfo.html)`>` | ` `[getAppUpdateInfo](https://developer.android.com/reference/com/google/android/play/core/appupdate/AppUpdateManager.html#getAppUpdateInfo())`() ` Requests the update availability for the current app, an intent to start an update flow, and, if applicable, the state of updates currently in progress.                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                      |
| ` abstract void`                                                                                                                                                                                                                  | ` `[registerListener](https://developer.android.com/reference/com/google/android/play/core/appupdate/AppUpdateManager.html#registerListener(com.google.android.play.core.install.InstallStateUpdatedListener))`(`[InstallStateUpdatedListener](https://developer.android.com/reference/com/google/android/play/core/install/InstallStateUpdatedListener.html)` listener) ` Registers a listener for this app that receives state changes for self-update operations.                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                              |
| ` abstract `[Task](https://developer.google.com/android/reference/com/google/android/gms/tasks/Task.html)`<`[Integer](https://developer.android.com/reference/java/lang/Integer.html)`>`                                          | ` `[startUpdateFlow](https://developer.android.com/reference/com/google/android/play/core/appupdate/AppUpdateManager.html#startUpdateFlow(com.google.android.play.core.appupdate.AppUpdateInfo,%20android.app.Activity,%20com.google.android.play.core.appupdate.AppUpdateOptions))`(`[AppUpdateInfo](https://developer.android.com/reference/com/google/android/play/core/appupdate/AppUpdateInfo.html)` appUpdateInfo, `[Activity](https://developer.android.com/reference/android/app/Activity.html)` activity, `[AppUpdateOptions](https://developer.android.com/reference/com/google/android/play/core/appupdate/AppUpdateOptions.html)` options) ` Starts the desired update flow asynchronously.                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                           |
| ` abstract boolean`                                                                                                                                                                                                               | ` `[startUpdateFlowForResult](https://developer.android.com/reference/com/google/android/play/core/appupdate/AppUpdateManager.html#startUpdateFlowForResult(com.google.android.play.core.appupdate.AppUpdateInfo,%20androidx.activity.result.ActivityResultLauncher<androidx.activity.result.IntentSenderRequest>,%20com.google.android.play.core.appupdate.AppUpdateOptions))`(`[AppUpdateInfo](https://developer.android.com/reference/com/google/android/play/core/appupdate/AppUpdateInfo.html)` appUpdateInfo, ActivityResultLauncher<IntentSenderRequest> activityResultLauncher, `[AppUpdateOptions](https://developer.android.com/reference/com/google/android/play/core/appupdate/AppUpdateOptions.html)` options) ` Starts the desired update flow.                                                                                                                                                                                                                                                                                                                                                                                                                                                                     |
| ` abstract boolean`                                                                                                                                                                                                               | ` `[startUpdateFlowForResult](https://developer.android.com/reference/com/google/android/play/core/appupdate/AppUpdateManager.html#startUpdateFlowForResult(com.google.android.play.core.appupdate.AppUpdateInfo,%20int,%20com.google.android.play.core.common.IntentSenderForResultStarter,%20int))`(`[AppUpdateInfo](https://developer.android.com/reference/com/google/android/play/core/appupdate/AppUpdateInfo.html)` appUpdateInfo, int appUpdateType, IntentSenderForResultStarter starter, int requestCode) ` *This method is deprecated. This API has been deprecated in favor of startUpdateFlowForResult(AppUpdateInfo, IntentSenderForResultStarter, AppUpdateOptions, int). Please use[AppUpdateOptions](https://developer.android.com/reference/com/google/android/play/core/appupdate/AppUpdateOptions.html)to specify[AppUpdateType](https://developer.android.com/reference/com/google/android/play/core/install/model/AppUpdateType.html).*                                                                                                                                                                                                                                                                     |
| ` abstract boolean`                                                                                                                                                                                                               | ` `[startUpdateFlowForResult](https://developer.android.com/reference/com/google/android/play/core/appupdate/AppUpdateManager.html#startUpdateFlowForResult(com.google.android.play.core.appupdate.AppUpdateInfo,%20android.app.Activity,%20com.google.android.play.core.appupdate.AppUpdateOptions,%20int))`(`[AppUpdateInfo](https://developer.android.com/reference/com/google/android/play/core/appupdate/AppUpdateInfo.html)` appUpdateInfo, `[Activity](https://developer.android.com/reference/android/app/Activity.html)` activity, `[AppUpdateOptions](https://developer.android.com/reference/com/google/android/play/core/appupdate/AppUpdateOptions.html)` options, int requestCode) ` Starts the desired update flow.                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                |
| ` abstract boolean`                                                                                                                                                                                                               | ` `[startUpdateFlowForResult](https://developer.android.com/reference/com/google/android/play/core/appupdate/AppUpdateManager.html#startUpdateFlowForResult(com.google.android.play.core.appupdate.AppUpdateInfo,%20int,%20android.app.Activity,%20int))`(`[AppUpdateInfo](https://developer.android.com/reference/com/google/android/play/core/appupdate/AppUpdateInfo.html)` appUpdateInfo, int appUpdateType, `[Activity](https://developer.android.com/reference/android/app/Activity.html)` activity, int requestCode) ` *This method is deprecated. This API has been deprecated in favor of[startUpdateFlowForResult(AppUpdateInfo, Activity, AppUpdateOptions, int)](https://developer.android.com/reference/com/google/android/play/core/appupdate/AppUpdateManager.html#startUpdateFlowForResult(com.google.android.play.core.appupdate.AppUpdateInfo,%20android.app.Activity,%20com.google.android.play.core.appupdate.AppUpdateOptions,%20int)). Please use[AppUpdateOptions](https://developer.android.com/reference/com/google/android/play/core/appupdate/AppUpdateOptions.html)to specify[AppUpdateType](https://developer.android.com/reference/com/google/android/play/core/install/model/AppUpdateType.html).* |
| ` abstract boolean`                                                                                                                                                                                                               | ` `[startUpdateFlowForResult](https://developer.android.com/reference/com/google/android/play/core/appupdate/AppUpdateManager.html#startUpdateFlowForResult(com.google.android.play.core.appupdate.AppUpdateInfo,%20com.google.android.play.core.common.IntentSenderForResultStarter,%20com.google.android.play.core.appupdate.AppUpdateOptions,%20int))`(`[AppUpdateInfo](https://developer.android.com/reference/com/google/android/play/core/appupdate/AppUpdateInfo.html)` appUpdateInfo, IntentSenderForResultStarter starter, `[AppUpdateOptions](https://developer.android.com/reference/com/google/android/play/core/appupdate/AppUpdateOptions.html)` options, int requestCode) ` Starts the desired update flow.                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                        |
| ` abstract void`                                                                                                                                                                                                                  | ` `[unregisterListener](https://developer.android.com/reference/com/google/android/play/core/appupdate/AppUpdateManager.html#unregisterListener(com.google.android.play.core.install.InstallStateUpdatedListener))`(`[InstallStateUpdatedListener](https://developer.android.com/reference/com/google/android/play/core/install/InstallStateUpdatedListener.html)` listener) ` Unregisters a listener you previously registered using[registerListener(InstallStateUpdatedListener)](https://developer.android.com/reference/com/google/android/play/core/appupdate/AppUpdateManager.html#registerListener(com.google.android.play.core.install.InstallStateUpdatedListener)).                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                    |

## Public methods

### completeUpdate

```
public abstract Task<Void> completeUpdate ()
```

For a flexible update flow, triggers the completion of the update.

You should call this method to complete an update that has already been started via[startUpdateFlowForResult(AppUpdateInfo, Activity, AppUpdateOptions, int)](https://developer.android.com/reference/com/google/android/play/core/appupdate/AppUpdateManager.html#startUpdateFlowForResult(com.google.android.play.core.appupdate.AppUpdateInfo,%20android.app.Activity,%20com.google.android.play.core.appupdate.AppUpdateOptions,%20int))and is in the[InstallStatus.DOWNLOADED](https://developer.android.com/reference/com/google/android/play/core/install/model/InstallStatus.html#DOWNLOADED)state.

<br />

|                                                                                    Returns                                                                                     ||
|------------------------------------------------------------------------------------------------------------------------------------------------------------------------|--------|
| [Task](https://developer.google.com/android/reference/com/google/android/gms/tasks/Task.html)`<`[Void](https://developer.android.com/reference/java/lang/Void.html)`>` | <br /> |

### getAppUpdateInfo

```
public abstract Task<AppUpdateInfo> getAppUpdateInfo ()
```

Requests the update availability for the current app, an intent to start an update flow, and, if applicable, the state of updates currently in progress.

To learn more, read[Check for update availability](https://developer.android.com/guide/app-bundle/in-app-updates).

<br />

|                                                                                                            Returns                                                                                                            ||
|-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|--------|
| [Task](https://developer.google.com/android/reference/com/google/android/gms/tasks/Task.html)`<`[AppUpdateInfo](https://developer.android.com/reference/com/google/android/play/core/appupdate/AppUpdateInfo.html)`>` | <br /> |

### registerListener

```
public abstract void registerListener (InstallStateUpdatedListener listener)
```

Registers a listener for this app that receives state changes for self-update operations. Typically, you need to register a listener for only*Flexible* updates, and listeners should be unregistered using[unregisterListener(InstallStateUpdatedListener)](https://developer.android.com/reference/com/google/android/play/core/appupdate/AppUpdateManager.html#unregisterListener(com.google.android.play.core.install.InstallStateUpdatedListener))when you no longer need them.

To learn more, read[Handle a flexible update](https://d.android.com/guide/app-bundle/in-app-updates#flexible_flow).

<br />

|                                     Parameters                                      ||
|------------|-------------------------------------------------------------------------|
| `listener` | `InstallStateUpdatedListener`: the listener you want to register <br /> |

### startUpdateFlow

```
public abstract Task<Integer> startUpdateFlow (AppUpdateInfo appUpdateInfo, 
                Activity activity, 
                AppUpdateOptions options)
```

Starts the desired update flow asynchronously.

Starts a flow with provided`options`. Requires an[AppUpdateInfo](https://developer.android.com/reference/com/google/android/play/core/appupdate/AppUpdateInfo.html), which you can receive from[getAppUpdateInfo()](https://developer.android.com/reference/com/google/android/play/core/appupdate/AppUpdateManager.html#getAppUpdateInfo()). This method can only start update flow types that are allowed according to[AppUpdateInfo.isUpdateTypeAllowed(AppUpdateOptions)](https://developer.android.com/reference/com/google/android/play/core/appupdate/AppUpdateInfo.html#isUpdateTypeAllowed(com.google.android.play.core.appupdate.AppUpdateOptions)).

The result from the In-app update flow's Activity will be returned within the[Task](https://developer.google.com/android/reference/com/google/android/gms/tasks/Task.html). If the update flow was displayed[Task.isSuccessful()](https://developer.google.com/android/reference/com/google/android/gms/tasks/Task.html#isSuccessful())you can check if the update was successful using[Task.getResult()](https://developer.google.com/android/reference/com/google/android/gms/tasks/Task.html#getResult()). The task is unsuccessful if you try to start the update flow but[AppUpdateInfo.isUpdateTypeAllowed(AppUpdateOptions)](https://developer.android.com/reference/com/google/android/play/core/appupdate/AppUpdateInfo.html#isUpdateTypeAllowed(com.google.android.play.core.appupdate.AppUpdateOptions))is false.

This method is preferable to its synchronous counterparts relying on`Activity#onActivityResult`if your app cannot change the onActivityResult() of its underlying activity, e.g. for some game engines.

Each[AppUpdateInfo](https://developer.android.com/reference/com/google/android/play/core/appupdate/AppUpdateInfo.html)instance can be used only in a single call to this method. If you need to call it multiple times - for instance, when retrying to start a flow in case of failure - you need to get a fresh[AppUpdateInfo](https://developer.android.com/reference/com/google/android/play/core/appupdate/AppUpdateInfo.html)from[getAppUpdateInfo()](https://developer.android.com/reference/com/google/android/play/core/appupdate/AppUpdateManager.html#getAppUpdateInfo()).

For a list of possible result values and parameter documentation, see[startUpdateFlowForResult(AppUpdateInfo, int, Activity, int)](https://developer.android.com/reference/com/google/android/play/core/appupdate/AppUpdateManager.html#startUpdateFlowForResult(com.google.android.play.core.appupdate.AppUpdateInfo,%20int,%20android.app.Activity,%20int)).

<br />

|                                                                                                                  Parameters                                                                                                                  ||
|-----------------|-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
| `appUpdateInfo` | `AppUpdateInfo`: an intent you use start an update. You get this using[getAppUpdateInfo()](https://developer.android.com/reference/com/google/android/play/core/appupdate/AppUpdateManager.html#getAppUpdateInfo()). <br /> |
| `activity`      | `Activity`: the Activity on whose Activity stack the update flow is run <br />                                                                                                                                              |
| `options`       | `AppUpdateOptions`: the update options, including the type of flow <br />                                                                                                                                                   |

|                                                                                                                                                                        Returns                                                                                                                                                                        ||
|------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|-------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
| [Task](https://developer.google.com/android/reference/com/google/android/gms/tasks/Task.html)`<`[Integer](https://developer.android.com/reference/java/lang/Integer.html)`>` | a[Task](https://developer.google.com/android/reference/com/google/android/gms/tasks/Task.html)that completes once the dialog has been accepted, denied or closed <br /> |

### startUpdateFlowForResult

```
public abstract boolean startUpdateFlowForResult (AppUpdateInfo appUpdateInfo, 
                ActivityResultLauncher<IntentSenderRequest> activityResultLauncher, 
                AppUpdateOptions options)
```

Starts the desired update flow.

This API uses the ActivityResultLauncher provided by Jetpack components to launch the update flow for result.

Starts a flow with the provided options, including the flow type. Requires an[AppUpdateInfo](https://developer.android.com/reference/com/google/android/play/core/appupdate/AppUpdateInfo.html), which you can receive from[getAppUpdateInfo()](https://developer.android.com/reference/com/google/android/play/core/appupdate/AppUpdateManager.html#getAppUpdateInfo()). This method can only start update flow types that are allowed according to[AppUpdateInfo.isUpdateTypeAllowed(AppUpdateOptions)](https://developer.android.com/reference/com/google/android/play/core/appupdate/AppUpdateInfo.html#isUpdateTypeAllowed(com.google.android.play.core.appupdate.AppUpdateOptions)).

Each[AppUpdateInfo](https://developer.android.com/reference/com/google/android/play/core/appupdate/AppUpdateInfo.html)instance can be used only in a single call to this method. If you need to call it multiple times - for instance, when retrying to start a flow in case of failure - you need to get a fresh[AppUpdateInfo](https://developer.android.com/reference/com/google/android/play/core/appupdate/AppUpdateInfo.html)from[getAppUpdateInfo()](https://developer.android.com/reference/com/google/android/play/core/appupdate/AppUpdateManager.html#getAppUpdateInfo()).

For a list of possible result values, see[startUpdateFlowForResult(AppUpdateInfo, Activity, AppUpdateOptions, int)](https://developer.android.com/reference/com/google/android/play/core/appupdate/AppUpdateManager.html#startUpdateFlowForResult(com.google.android.play.core.appupdate.AppUpdateInfo,%20android.app.Activity,%20com.google.android.play.core.appupdate.AppUpdateOptions,%20int)).

<br />

|                                                                                                                        Parameters                                                                                                                        ||
|--------------------------|--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
| `appUpdateInfo`          | `AppUpdateInfo`: an intent you use to start an update. You get this using[getAppUpdateInfo()](https://developer.android.com/reference/com/google/android/play/core/appupdate/AppUpdateManager.html#getAppUpdateInfo()). <br /> |
| `activityResultLauncher` | `ActivityResultLauncher`: An ActivityResultLauncher to launch the update flow. <br />                                                                                                                                          |
| `options`                | `AppUpdateOptions`: the update options, including the type of flow. <br />                                                                                                                                                     |

|                           Returns                           ||
|-----------|--------------------------------------------------|
| `boolean` | whether the requested update has started. <br /> |

### startUpdateFlowForResult

```
public abstract boolean startUpdateFlowForResult (AppUpdateInfo appUpdateInfo, 
                int appUpdateType, 
                IntentSenderForResultStarter starter, 
                int requestCode)
```

<br />

**This method is deprecated.**   
This API has been deprecated in favor of startUpdateFlowForResult(AppUpdateInfo, IntentSenderForResultStarter, AppUpdateOptions, int). Please use[AppUpdateOptions](https://developer.android.com/reference/com/google/android/play/core/appupdate/AppUpdateOptions.html)to specify[AppUpdateType](https://developer.android.com/reference/com/google/android/play/core/install/model/AppUpdateType.html).

Starts the desired update flow.

This method should be called if you are starting the flow from a Component different from an`Activity`and you don't want to receive the`onActivityResult`call on the Activity.

This is identical to calling[startUpdateFlowForResult(AppUpdateInfo, IntentSenderForResultStarter, AppUpdateOptions, int)](https://developer.android.com/reference/com/google/android/play/core/appupdate/AppUpdateManager.html#startUpdateFlowForResult(com.google.android.play.core.appupdate.AppUpdateInfo,%20com.google.android.play.core.common.IntentSenderForResultStarter,%20com.google.android.play.core.appupdate.AppUpdateOptions,%20int)), with the[AppUpdateOptions.defaultOptions(int)](https://developer.android.com/reference/com/google/android/play/core/appupdate/AppUpdateOptions.html#defaultOptions(int))for the requested update flow. See its documentation for further information.

For a list of possible result values and parameter documentation, see[startUpdateFlowForResult(AppUpdateInfo, IntentSenderForResultStarter, AppUpdateOptions, int)](https://developer.android.com/reference/com/google/android/play/core/appupdate/AppUpdateManager.html#startUpdateFlowForResult(com.google.android.play.core.appupdate.AppUpdateInfo,%20com.google.android.play.core.common.IntentSenderForResultStarter,%20com.google.android.play.core.appupdate.AppUpdateOptions,%20int)).

<br />

|                       Parameters                       ||
|-----------------|---------------------------------------|
| `appUpdateInfo` | `AppUpdateInfo` <br />                |
| `appUpdateType` | `int` <br />                          |
| `starter`       | `IntentSenderForResultStarter` <br /> |
| `requestCode`   | `int` <br />                          |

|      Returns      ||
|-----------|--------|
| `boolean` | <br /> |

|                                                                Throws                                                                ||
|-----------------------------------------------------------------------------------------------------------------------------------|---|
| [IntentSender.SendIntentException](https://developer.android.com/reference/android/content/IntentSender.SendIntentException.html) |   |

### startUpdateFlowForResult

```
public abstract boolean startUpdateFlowForResult (AppUpdateInfo appUpdateInfo, 
                Activity activity, 
                AppUpdateOptions options, 
                int requestCode)
```

Starts the desired update flow.

Starts a flow according to the provided options, which include the[AppUpdateType](https://developer.android.com/reference/com/google/android/play/core/install/model/AppUpdateType.html).

Requires an[AppUpdateInfo](https://developer.android.com/reference/com/google/android/play/core/appupdate/AppUpdateInfo.html), which you can receive from[getAppUpdateInfo()](https://developer.android.com/reference/com/google/android/play/core/appupdate/AppUpdateManager.html#getAppUpdateInfo()). This method can only start update flow types that are allowed according to[AppUpdateInfo.isUpdateTypeAllowed(AppUpdateOptions)](https://developer.android.com/reference/com/google/android/play/core/appupdate/AppUpdateInfo.html#isUpdateTypeAllowed(com.google.android.play.core.appupdate.AppUpdateOptions)).

Similar to[Activity.startActivityForResult(Intent, int)](https://developer.android.com/reference/android/app/Activity.html#startActivityForResult(android.content.Intent,%20int)), this method is run "for result". The result from the flow's Activity can be handled by the provided`activity`'s`Activity#onActivityResult`and is tagged with the provided`requestCode`.

Each[AppUpdateInfo](https://developer.android.com/reference/com/google/android/play/core/appupdate/AppUpdateInfo.html)instance can be used only in a single call to this method. If you need to call it multiple times - for instance, when retrying to start a flow in case of failure - you need to get a fresh[AppUpdateInfo](https://developer.android.com/reference/com/google/android/play/core/appupdate/AppUpdateInfo.html)from[getAppUpdateInfo()](https://developer.android.com/reference/com/google/android/play/core/appupdate/AppUpdateManager.html#getAppUpdateInfo()).

In the*flexible*flow, the Activity returns right after user confirmation with one of the following values:

- [Activity.RESULT_OK](https://developer.android.com/reference/android/app/Activity.html#RESULT_OK): The user accepted the request to update.
- [Activity.RESULT_CANCELED](https://developer.android.com/reference/android/app/Activity.html#RESULT_CANCELED): The user denied the request to update.
- [ActivityResult.RESULT_IN_APP_UPDATE_FAILED](https://developer.android.com/reference/com/google/android/play/core/install/model/ActivityResult.html#RESULT_IN_APP_UPDATE_FAILED): Something failed during the request for user confirmation. For example, the user terminates the app before responding to the request.

In the*immediate*flow, the Activity returns one of the following values:

- [Activity.RESULT_OK](https://developer.android.com/reference/android/app/Activity.html#RESULT_OK): The user accepted and the update succeeded (which, in practice, your app never should never receive because it already updated).
- [Activity.RESULT_CANCELED](https://developer.android.com/reference/android/app/Activity.html#RESULT_CANCELED): The user denied or canceled the update.
- [ActivityResult.RESULT_IN_APP_UPDATE_FAILED](https://developer.android.com/reference/com/google/android/play/core/install/model/ActivityResult.html#RESULT_IN_APP_UPDATE_FAILED): The flow failed either during the user confirmation, the download, or the installation.

<br />

<br />

|                                                                                                                  Parameters                                                                                                                  ||
|-----------------|-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
| `appUpdateInfo` | `AppUpdateInfo`: an intent you use start an update. You get this using[getAppUpdateInfo()](https://developer.android.com/reference/com/google/android/play/core/appupdate/AppUpdateManager.html#getAppUpdateInfo()). <br /> |
| `activity`      | `Activity`: the Activity that will be used for`Activity#onActivityResult` <br />                                                                                                                                            |
| `options`       | `AppUpdateOptions`: the update options, including the type of flow <br />                                                                                                                                                   |
| `requestCode`   | `int`: the request code that will be used for`Activity#onActivityResult` <br />                                                                                                                                             |

|                          Returns                           ||
|-----------|-------------------------------------------------|
| `boolean` | whether the requested update has started <br /> |

|                                                                                                Throws                                                                                                ||
|-----------------------------------------------------------------------------------------------------------------------------------|-------------------------------------------------------------------|
| [IntentSender.SendIntentException](https://developer.android.com/reference/android/content/IntentSender.SendIntentException.html) | if there is an error when starting the flow's Activity for result |

### startUpdateFlowForResult

```
public abstract boolean startUpdateFlowForResult (AppUpdateInfo appUpdateInfo, 
                int appUpdateType, 
                Activity activity, 
                int requestCode)
```

<br />

**This method is deprecated.**   
This API has been deprecated in favor of[startUpdateFlowForResult(AppUpdateInfo, Activity, AppUpdateOptions, int)](https://developer.android.com/reference/com/google/android/play/core/appupdate/AppUpdateManager.html#startUpdateFlowForResult(com.google.android.play.core.appupdate.AppUpdateInfo,%20android.app.Activity,%20com.google.android.play.core.appupdate.AppUpdateOptions,%20int)). Please use[AppUpdateOptions](https://developer.android.com/reference/com/google/android/play/core/appupdate/AppUpdateOptions.html)to specify[AppUpdateType](https://developer.android.com/reference/com/google/android/play/core/install/model/AppUpdateType.html).

Starts the desired update flow.

Starts a flow of the provided[AppUpdateType](https://developer.android.com/reference/com/google/android/play/core/install/model/AppUpdateType.html).

This is identical to calling[startUpdateFlowForResult(AppUpdateInfo, Activity, AppUpdateOptions, int)](https://developer.android.com/reference/com/google/android/play/core/appupdate/AppUpdateManager.html#startUpdateFlowForResult(com.google.android.play.core.appupdate.AppUpdateInfo,%20android.app.Activity,%20com.google.android.play.core.appupdate.AppUpdateOptions,%20int)), with the[AppUpdateOptions.defaultOptions(int)](https://developer.android.com/reference/com/google/android/play/core/appupdate/AppUpdateOptions.html#defaultOptions(int))for the requested update flow. See its documentation for further information.

For a list of possible result values and parameter documentation, see[startUpdateFlowForResult(AppUpdateInfo, Activity, AppUpdateOptions, int)](https://developer.android.com/reference/com/google/android/play/core/appupdate/AppUpdateManager.html#startUpdateFlowForResult(com.google.android.play.core.appupdate.AppUpdateInfo,%20android.app.Activity,%20com.google.android.play.core.appupdate.AppUpdateOptions,%20int)).

<br />

|               Parameters                ||
|-----------------|------------------------|
| `appUpdateInfo` | `AppUpdateInfo` <br /> |
| `appUpdateType` | `int` <br />           |
| `activity`      | `Activity` <br />      |
| `requestCode`   | `int` <br />           |

|      Returns      ||
|-----------|--------|
| `boolean` | <br /> |

|                                                                Throws                                                                ||
|-----------------------------------------------------------------------------------------------------------------------------------|---|
| [IntentSender.SendIntentException](https://developer.android.com/reference/android/content/IntentSender.SendIntentException.html) |   |

### startUpdateFlowForResult

```
public abstract boolean startUpdateFlowForResult (AppUpdateInfo appUpdateInfo, 
                IntentSenderForResultStarter starter, 
                AppUpdateOptions options, 
                int requestCode)
```

Starts the desired update flow.

This method should be called if you are starting the flow from a Component different from an`Activity`and you don't want to receive the`onActivityResult`call on the Activity.

For example, you can use it for`androidx.fragment.app.Fragment`:  

    startUpdateFlowForResult(info, type, fragment::startIntentSenderForResult, requestCode);
     
Starts a flow with the provided options, including the flow type. Requires an[AppUpdateInfo](https://developer.android.com/reference/com/google/android/play/core/appupdate/AppUpdateInfo.html), which you can receive from[getAppUpdateInfo()](https://developer.android.com/reference/com/google/android/play/core/appupdate/AppUpdateManager.html#getAppUpdateInfo()). This method can only start update flow types that are allowed according to[AppUpdateInfo.isUpdateTypeAllowed(AppUpdateOptions)](https://developer.android.com/reference/com/google/android/play/core/appupdate/AppUpdateInfo.html#isUpdateTypeAllowed(com.google.android.play.core.appupdate.AppUpdateOptions)).

Similar to[Activity.startActivityForResult(Intent, int)](https://developer.android.com/reference/android/app/Activity.html#startActivityForResult(android.content.Intent,%20int)), this method is run "for result". The result from the flow's Activity can be handled by the`onActivityResult`of the object that would normally receive an activity result when the`starter`'s`startIntentSenderForResult`is called. The result is tagged with the provided`requestCode`.

Each[AppUpdateInfo](https://developer.android.com/reference/com/google/android/play/core/appupdate/AppUpdateInfo.html)instance can be used only in a single call to this method. If you need to call it multiple times - for instance, when retrying to start a flow in case of failure - you need to get a fresh[AppUpdateInfo](https://developer.android.com/reference/com/google/android/play/core/appupdate/AppUpdateInfo.html)from[getAppUpdateInfo()](https://developer.android.com/reference/com/google/android/play/core/appupdate/AppUpdateManager.html#getAppUpdateInfo()).

For a list of possible result values, see[startUpdateFlowForResult(AppUpdateInfo, Activity, AppUpdateOptions, int)](https://developer.android.com/reference/com/google/android/play/core/appupdate/AppUpdateManager.html#startUpdateFlowForResult(com.google.android.play.core.appupdate.AppUpdateInfo,%20android.app.Activity,%20com.google.android.play.core.appupdate.AppUpdateOptions,%20int)).

<br />

|                                                                                                                  Parameters                                                                                                                  ||
|-----------------|-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
| `appUpdateInfo` | `AppUpdateInfo`: an intent you use start an update. You get this using[getAppUpdateInfo()](https://developer.android.com/reference/com/google/android/play/core/appupdate/AppUpdateManager.html#getAppUpdateInfo()). <br /> |
| `starter`       | `IntentSenderForResultStarter`: will be used for`startIntentSenderForResult` <br />                                                                                                                                         |
| `options`       | `AppUpdateOptions`: the update options, including the type of flow <br />                                                                                                                                                   |
| `requestCode`   | `int`: the request code that will be used for`Activity#onActivityResult` <br />                                                                                                                                             |

|                          Returns                           ||
|-----------|-------------------------------------------------|
| `boolean` | whether the requested update has started <br /> |

|                                                                                                Throws                                                                                                ||
|-----------------------------------------------------------------------------------------------------------------------------------|-------------------------------------------------------------------|
| [IntentSender.SendIntentException](https://developer.android.com/reference/android/content/IntentSender.SendIntentException.html) | if there is an error when starting the flow's Activity for result |

### unregisterListener

```
public abstract void unregisterListener (InstallStateUpdatedListener listener)
```

Unregisters a listener you previously registered using[registerListener(InstallStateUpdatedListener)](https://developer.android.com/reference/com/google/android/play/core/appupdate/AppUpdateManager.html#registerListener(com.google.android.play.core.install.InstallStateUpdatedListener)).

To learn more, read[Handle a flexible update](https://d.android.com/guide/app-bundle/in-app-updates#flexible_flow).

<br />

|                                      Parameters                                       ||
|------------|---------------------------------------------------------------------------|
| `listener` | `InstallStateUpdatedListener`: the listener you want to unregister <br /> |