Play In-App Update
Native API for Play In-App Update.
Summary
Typedefs |
|
---|---|
AppUpdateInfo
|
typedefstruct AppUpdateInfo_
An opaque struct used to access information about an update. |
AppUpdateOptions
|
typedefstruct AppUpdateOptions_
An opaque struct used to provide options for an update. |
Functions |
|
---|---|
AppUpdateInfo_destroy(AppUpdateInfo *info)
|
void
Releases the specified AppUpdateInfo and any references it holds.
|
AppUpdateInfo_getAvailability(AppUpdateInfo *info)
|
Returns the update availability for the specified AppUpdateInfo.
|
AppUpdateInfo_getAvailableVersionCode(AppUpdateInfo *info)
|
uint32_t
Returns the latest available version code for the specified AppUpdateInfo.
|
AppUpdateInfo_getBytesDownloaded(AppUpdateInfo *info)
|
uint64_t
Returns the total number in bytes already downloaded for the specified AppUpdateInfo.
|
AppUpdateInfo_getClientVersionStalenessDays(AppUpdateInfo *info)
|
int32_t
Returns the number of days that the Google Play Store app on the user's device has known about an available update.
|
AppUpdateInfo_getPriority(AppUpdateInfo *info)
|
int32_t
Returns the priority for this update, as defined by the developer in the Google Play Developer API.
|
AppUpdateInfo_getStatus(AppUpdateInfo *info)
|
Returns the update status for the specified AppUpdateInfo.
|
AppUpdateInfo_getTotalBytesToDownload(AppUpdateInfo *info)
|
uint64_t
Returns the total bytes to download for the specified AppUpdateInfo.
|
AppUpdateInfo_isUpdateTypeAllowed(AppUpdateInfo *info, AppUpdateOptions *options)
|
bool
Returns whether an update is allowed for the specified AppUpdateInfo and AppUpdateOptions.
|
AppUpdateManager_destroy()
|
void
Frees up memory allocated for the in-app update API.
|
AppUpdateManager_getInfo(AppUpdateInfo **out_info)
|
Gets the result of an ongoing or completed call to AppUpdateManager_requestInfo(), AppUpdateManager_requestStartUpdate(), or AppUpdateManager_requestCompleteUpdate().
|
AppUpdateManager_init(JavaVM *jvm, jobject android_context)
|
Initialize the in-app update API, making the other functions available to call.
|
AppUpdateManager_onPause()
|
Deregisters an internal update status listener.
|
AppUpdateManager_onResume()
|
Registers an internal update status listener.
|
AppUpdateManager_requestCompleteUpdate()
|
Asynchronously requests to complete a flexible in-app update flow that was started via AppUpdateManager_requestStartUpdate().
|
AppUpdateManager_requestInfo()
|
Asynchronously requests information about an update.
|
AppUpdateManager_requestStartUpdate(AppUpdateInfo *info, AppUpdateOptions *options, jobject android_activity)
|
Asynchronously requests to start the in-app update flow.
|
AppUpdateOptions_createOptions(AppUpdateType type, AppUpdateOptions **out_options)
|
Creates a new AppUpdateOptions with the specified AppUpdateType.
|
AppUpdateOptions_destroy(AppUpdateOptions *options)
|
void
Releases the specified AppUpdateOptions and any references it holds.
|
AppUpdateOptions_getAppUpdateType(AppUpdateOptions *options)
|
Returns the update type for the specified AppUpdateOptions.
|
AppUpdateOptions_isAssetPackDeletionAllowed(AppUpdateOptions *options)
|
bool
Returns whether the app installer should be allowed to delete some asset packs from the app's storage before attempting to update the app, for example if disk space is limited.
|
AppUpdateOptions_setAssetPackDeletionAllowed(AppUpdateOptions *options, bool allow)
|
Indicates whether the app installer is allowed to delete existing asset packs while updating the app, for example if disk space is limited.
|
Enumerations
AppUpdateAvailability
AppUpdateAvailability
Availability info for an in-app update.
AppUpdateErrorCode
AppUpdateErrorCode
Errors that can be encountered while using the in-app update API.
Properties | |
---|---|
APP_UPDATE_API_NOT_AVAILABLE
|
The in-app update API isn't available on this device. |
APP_UPDATE_APP_NOT_OWNED
|
The app isn't owned by any user on this device. An app is "owned" if it has been acquired from the Play Store. |
APP_UPDATE_DOWNLOAD_NOT_PRESENT
|
The update has not been (fully) downloaded yet. |
APP_UPDATE_INITIALIZATION_FAILED
|
Error initializing dependencies. |
APP_UPDATE_INITIALIZATION_NEEDED
|
The requested operation failed: call AppUpdateManager_init() first. |
APP_UPDATE_INTERNAL_ERROR
|
An internal error occurred. |
APP_UPDATE_INVALID_REQUEST
|
The function call was invalid, for example due to specifying a null parameter. |
APP_UPDATE_IN_PROGRESS
|
The update is already in progress and there is no UI flow to resume. |
APP_UPDATE_NOT_ALLOWED
|
The update isn't allowed due to the current device state, for example low battery or low disk space. |
APP_UPDATE_NO_ERROR
|
No error has occurred. |
APP_UPDATE_PLAY_STORE_NOT_FOUND
|
The Play Store app is either not installed or not the official version. |
APP_UPDATE_UNAVAILABLE
|
The update is unavailable to this user or device. |
APP_UPDATE_UNKNOWN_ERROR
|
An unknown error occurred. |
AppUpdateStatus
AppUpdateStatus
Status returned when requesting an in-app update.
AppUpdateType
AppUpdateType
Methods for performing the in-app update flow.
Note: regardless of the method selected, the app needs to be restarted to install an update.
Typedefs
AppUpdateInfo
struct AppUpdateInfo_ AppUpdateInfo
An opaque struct used to access information about an update.
AppUpdateOptions
struct AppUpdateOptions_ AppUpdateOptions
An opaque struct used to provide options for an update.
Functions
AppUpdateInfo_destroy
void AppUpdateInfo_destroy( AppUpdateInfo *info )
Releases the specified AppUpdateInfo and any references it holds.
Except for rare cases, this function doesn't make JNI calls and can be called every frame.
Details | |||
---|---|---|---|
Parameters |
|
AppUpdateInfo_getAvailability
AppUpdateAvailability AppUpdateInfo_getAvailability( AppUpdateInfo *info )
Returns the update availability for the specified AppUpdateInfo.
Details | |||
---|---|---|---|
Parameters |
|
||
Returns |
The update availability, for example APP_UPDATE_AVAILABLE.
|
AppUpdateInfo_getAvailableVersionCode
uint32_t AppUpdateInfo_getAvailableVersionCode( AppUpdateInfo *info )
Returns the latest available version code for the specified AppUpdateInfo.
Details | |||
---|---|---|---|
Parameters |
|
||
Returns |
The available version code for the update, or 0 if unknown.
|
AppUpdateInfo_getBytesDownloaded
uint64_t AppUpdateInfo_getBytesDownloaded( AppUpdateInfo *info )
Returns the total number in bytes already downloaded for the specified AppUpdateInfo.
Details | |||
---|---|---|---|
Parameters |
|
||
Returns |
The total number of bytes already downloaded.
|
AppUpdateInfo_getClientVersionStalenessDays
int32_t AppUpdateInfo_getClientVersionStalenessDays( AppUpdateInfo *info )
Returns the number of days that the Google Play Store app on the user's device has known about an available update.
Details | |||
---|---|---|---|
Parameters |
|
||
Returns |
The number of days an app update has been available, or -1 if unknown or unavailable.
|
AppUpdateInfo_getPriority
int32_t AppUpdateInfo_getPriority( AppUpdateInfo *info )
Returns the priority for this update, as defined by the developer in the Google Play Developer API.
Details | |||
---|---|---|---|
Parameters |
|
||
Returns |
The update priority, or 0 if unknown or unavailable.
|
AppUpdateInfo_getStatus
AppUpdateStatus AppUpdateInfo_getStatus( AppUpdateInfo *info )
Returns the update status for the specified AppUpdateInfo.
Details | |||
---|---|---|---|
Parameters |
|
||
Returns |
The update status, for example APP_UPDATE_REQUEST_INFO_PENDING.
|
AppUpdateInfo_getTotalBytesToDownload
uint64_t AppUpdateInfo_getTotalBytesToDownload( AppUpdateInfo *info )
Returns the total bytes to download for the specified AppUpdateInfo.
Details | |||
---|---|---|---|
Parameters |
|
||
Returns |
The total size in bytes for the update, or 0 if unknown.
|
AppUpdateInfo_isUpdateTypeAllowed
bool AppUpdateInfo_isUpdateTypeAllowed( AppUpdateInfo *info, AppUpdateOptions *options )
Returns whether an update is allowed for the specified AppUpdateInfo and AppUpdateOptions.
This function's result can be checked prior to calling AppUpdateManager_requestStartUpdate().
Details | |||||
---|---|---|---|---|---|
Parameters |
|
||||
Returns |
True if the specified update options are allowed, or false if either the update isn't allowed or if there is an error, for example due to invalid parameters.
|
AppUpdateManager_destroy
void AppUpdateManager_destroy()
Frees up memory allocated for the in-app update API.
Does nothing if AppUpdateManager_init() hasn't been called.
AppUpdateManager_getInfo
AppUpdateErrorCode AppUpdateManager_getInfo( AppUpdateInfo **out_info )
Gets the result of an ongoing or completed call to AppUpdateManager_requestInfo(), AppUpdateManager_requestStartUpdate(), or AppUpdateManager_requestCompleteUpdate().
This function doesn't make JNI calls and can be called every frame to monitor progress. See also:AppUpdateInfo_destroy
Details | |||
---|---|---|---|
Parameters |
|
||
Returns |
APP_UPDATE_NO_ERROR if the request is ongoing or successful, or an error indicating why in-app update may not currently be possible.
|
AppUpdateManager_init
AppUpdateErrorCode AppUpdateManager_init( JavaVM *jvm, jobject android_context )
Initialize the in-app update API, making the other functions available to call.
See also: AppUpdateManager_destroy
Details | |||||
---|---|---|---|---|---|
Parameters |
|
||||
Returns |
APP_UPDATE_NO_ERROR if initialization succeeded, or an error if not.
|
AppUpdateManager_onPause
AppUpdateErrorCode AppUpdateManager_onPause()
Deregisters an internal update status listener.
Must be called in ANativeActivity ANativeActivityCallbacks's onPause, or equivalent.
Details | |
---|---|
Returns |
APP_UPDATE_NO_ERROR if the call succeeded, or an error if not.
|
AppUpdateManager_onResume
AppUpdateErrorCode AppUpdateManager_onResume()
Registers an internal update status listener.
Must be called in ANativeActivity ANativeActivityCallbacks's onResume, or equivalent.
Details | |
---|---|
Returns |
APP_UPDATE_NO_ERROR if the call succeeded, or an error if not.
|
AppUpdateManager_requestCompleteUpdate
AppUpdateErrorCode AppUpdateManager_requestCompleteUpdate()
Asynchronously requests to complete a flexible in-app update flow that was started via AppUpdateManager_requestStartUpdate().
This function can be called after the update reaches the APP_UPDATE_DOWNLOADED status. After calling this function the system installer will close the app, perform the update, and then restart the app at the updated version.
Details | |
---|---|
Returns |
APP_UPDATE_NO_ERROR if the update completion request started successfully, or an error if not.
|
AppUpdateManager_requestInfo
AppUpdateErrorCode AppUpdateManager_requestInfo()
Asynchronously requests information about an update.
Needs to be called once before AppUpdateManager_requestStartUpdate() to obtain an AppUpdateInfo, which is required to launch the in-app update flow.
Use AppUpdateManager_getInfo() to poll for the result.
Note: this function isn't idempotent and restarts the request on every call.
Details | |
---|---|
Returns |
APP_UPDATE_NO_ERROR if the request started successfully, or an error if not.
|
AppUpdateManager_requestStartUpdate
AppUpdateErrorCode AppUpdateManager_requestStartUpdate( AppUpdateInfo *info, AppUpdateOptions *options, jobject android_activity )
Asynchronously requests to start the in-app update flow.
Use AppUpdateManager_getInfo() to monitor the current status and download progress of the ongoing asynchronous update operation.
Details | |||||||
---|---|---|---|---|---|---|---|
Parameters |
|
||||||
Returns |
APP_UPDATE_NO_ERROR if the request started successfully, or an error if not.
|
AppUpdateOptions_createOptions
AppUpdateErrorCode AppUpdateOptions_createOptions( AppUpdateType type, AppUpdateOptions **out_options )
Creates a new AppUpdateOptions with the specified AppUpdateType.
See also: AppUpdateOptions_destroy
Details | |||||
---|---|---|---|---|---|
Parameters |
|
||||
Returns |
APP_UPDATE_NO_ERROR if an AppUpdateOptions is created successfully, or an error if not.
|
AppUpdateOptions_destroy
void AppUpdateOptions_destroy( AppUpdateOptions *options )
Releases the specified AppUpdateOptions and any references it holds.
Details | |||
---|---|---|---|
Parameters |
|
AppUpdateOptions_getAppUpdateType
AppUpdateType AppUpdateOptions_getAppUpdateType( AppUpdateOptions *options )
Returns the update type for the specified AppUpdateOptions.
Details | |||
---|---|---|---|
Parameters |
|
||
Returns |
The type of app update flow.
|
AppUpdateOptions_isAssetPackDeletionAllowed
bool AppUpdateOptions_isAssetPackDeletionAllowed( AppUpdateOptions *options )
Returns whether the app installer should be allowed to delete some asset packs from the app's storage before attempting to update the app, for example if disk space is limited.
Details | |||
---|---|---|---|
Parameters |
|
||
Returns |
Bool indicating whether the app installer should be allowed to delete asset packs (if necessary) during an app update.
|
AppUpdateOptions_setAssetPackDeletionAllowed
AppUpdateErrorCode AppUpdateOptions_setAssetPackDeletionAllowed( AppUpdateOptions *options, bool allow )
Indicates whether the app installer is allowed to delete existing asset packs while updating the app, for example if disk space is limited.
Details | |||||
---|---|---|---|---|---|
Parameters |
|
||||
Returns |
APP_UPDATE_NO_ERROR if the value is set successfully, or an error if not.
|