AppUpdateInfo

public class AppUpdateInfo
extends Object

java.lang.Object
   ↳ com.google.android.play.core.appupdate.AppUpdateInfo


Contains information about the avilability and progress of an app update.

To learn more, see support in-app updates.

Summary

Public methods

int availableVersionCode()

If an update is available or in progress, this method returns the version code of the update.

long bytesDownloaded()

Returns the number of bytes downloaded so far.

Integer clientVersionStalenessDays()

If an update is available or in progress, this method returns the number of days since the Google Play Store app on the user's device has learnt about an available update.

Set<Integer> getFailedUpdatePreconditions(AppUpdateOptions options)

Returns a set of UpdatePreconditions describing why an update flow is currently not allowed to be started.

int installStatus()

Returns the progress status of the update.

boolean isUpdateTypeAllowed(AppUpdateOptions appUpdateOptions)

Returns whether an update with the provided options is allowed.

boolean isUpdateTypeAllowed(int updateType)

Returns whether the desired update type, such as flexible or immediate, is allowed.

String packageName()

Returns the package name for the app to be updated.

long totalBytesToDownload()

Returns the total number of bytes to be downloaded for this update.

int updateAvailability()

Returns whether an update is available for the app.

int updatePriority()

Returns the in-app update priority for this update, as defined by the developer in the Google Play Developer API.

Inherited methods

Public methods

availableVersionCode

public int availableVersionCode ()

If an update is available or in progress, this method returns the version code of the update.

If no updates are available, this method returns an arbitrary value.

Returns
int

clientVersionStalenessDays

public Integer clientVersionStalenessDays ()

If an update is available or in progress, this method returns the number of days since the Google Play Store app on the user's device has learnt about an available update.

If update is not available, or if staleness information is unavailable, this method returns null.

Returns
Integer

getFailedUpdatePreconditions

public Set<Integer> getFailedUpdatePreconditions (AppUpdateOptions options)

Returns a set of UpdatePreconditions describing why an update flow is currently not allowed to be started.

Returns an empty set if no update is available or the update flow is allowed to be started.

Parameters
options AppUpdateOptions

Returns
Set<Integer>

installStatus

public int installStatus ()

Returns the progress status of the update.

The return value is defined only if updateAvailability() returns UpdateAvailability.DEVELOPER_TRIGGERED_UPDATE_IN_PROGRESS.

To see examples, go to Install a flexible update.

Returns
int a value from InstallStatus

isUpdateTypeAllowed

public boolean isUpdateTypeAllowed (AppUpdateOptions appUpdateOptions)

Returns whether an update with the provided options is allowed.

To learn more, read Check for update availability.

Parameters
appUpdateOptions AppUpdateOptions

Returns
boolean

isUpdateTypeAllowed

public boolean isUpdateTypeAllowed (int updateType)

Returns whether the desired update type, such as flexible or immediate, is allowed.

To learn more, read Check for update availability.

Parameters
updateType int: a value from AppUpdateType

Returns
boolean

packageName

public String packageName ()

Returns the package name for the app to be updated.

Returns
String

totalBytesToDownload

public long totalBytesToDownload ()

Returns the total number of bytes to be downloaded for this update.

The return value is defined only if installStatus() returns InstallStatus.DOWNLOADING.

Returns
long

updateAvailability

public int updateAvailability ()

Returns whether an update is available for the app.

To learn more, read Check for update availability.

Returns
int a value from UpdateAvailability

updatePriority

public int updatePriority ()

Returns the in-app update priority for this update, as defined by the developer in the Google Play Developer API.

You can define in-app update priority of a release by setting 'inAppUpdatePriority' field under Edits.tracks.releases.

The return value is defined only if updateAvailability() returns UpdateAvailability.UPDATE_AVAILABLE.

Returns
int