Google.Play.AssetDelivery.PlayAssetDelivery

Provides methods for retrieving asset packs via the Play Asset Delivery system.

Summary

Public static functions

GetDownloadSize(string assetPackName)
PlayAsyncOperation< long, AssetDeliveryErrorCode >
Starts a PlayAsyncOperation to determine the download size in bytes of the specified asset pack.
IsDownloaded(string assetPackName)
bool
Returns whether or not the the latest version of the specified asset pack is available on disk.
RemoveAssetPack(string assetPackName)
PlayAsyncOperation< VoidResult, AssetDeliveryErrorCode >
Starts a PlayAsyncOperation to delete the specified asset pack from internal storage.
RetrieveAssetBundleAsync(string assetBundleName)
Starts a PlayAssetBundleRequest to retrieve an asset pack containing only the specified AssetBundle.
RetrieveAssetPackAsync(string assetPackName)
Starts a PlayAssetPackRequest to retrieve the specified asset pack.
RetrieveAssetPackBatchAsync(IList< string > assetPackNames)
Starts a PlayAssetPackBatchRequest to retrieve the specified asset packs.
ShowCellularDataConfirmation()
Shows a confirmation dialog for all currently downloading asset packs that are AssetDeliveryStatus.WaitingForWifi.

Public static functions

GetDownloadSize

PlayAsyncOperation< long, AssetDeliveryErrorCode > GetDownloadSize(
  string assetPackName
)

Starts a PlayAsyncOperation to determine the download size in bytes of the specified asset pack.

If the specified asset pack's delivery mode is install-time, then the download size will always be 0.

IsDownloaded

bool IsDownloaded(
  string assetPackName
)

Returns whether or not the the latest version of the specified asset pack is available on disk.

Details
Parameters
assetPackName
The name of the desired asset pack.
Returns
True if the asset pack is available on disk and false if not.

RemoveAssetPack

PlayAsyncOperation< VoidResult, AssetDeliveryErrorCode > RemoveAssetPack(
  string assetPackName
)

Starts a PlayAsyncOperation to delete the specified asset pack from internal storage.

If the specified asset pack is currently being retrieved, this method will not cancel the retrieval. If the specified asset pack contains any AssetBundles that are already loaded into memory, the AssetBundles will not be unloaded.

Details
Returns
An async operation object used to monitor the asset pack removal. If the files are deleted successfully or if the files don't exist, the returned operation will complete successfully. Otherwise, the operation will complete with an error code.

RetrieveAssetBundleAsync

PlayAssetBundleRequest RetrieveAssetBundleAsync(
  string assetBundleName
)

Starts a PlayAssetBundleRequest to retrieve an asset pack containing only the specified AssetBundle.

Both the AssetBundle and asset pack must share the same name. Downloads the asset pack if the latest version isn't already available on disk.

After download, the contained AssetBundle is loaded into memory before the request completes.

Details
Parameters
assetBundleName
The name of the requested AssetBundle.
Exceptions
ArgumentException
Thrown if there is already an active request with the specified name.
Returns
A request object used to monitor the asynchronous AssetBundle retrieval.

RetrieveAssetPackAsync

PlayAssetPackRequest RetrieveAssetPackAsync(
  string assetPackName
)

Starts a PlayAssetPackRequest to retrieve the specified asset pack.

Downloads the asset pack if the latest version isn't already available on disk.

After download, the assets and/or AssetBundles contained in the asset pack are not loaded into memory. To load them see PlayAssetPackRequest.GetAssetLocation or PlayAssetPackRequest.LoadAssetBundleAsync.

Details
Parameters
assetPackName
The name of the requested asset pack.
Returns
A request object used to monitor the asynchronous asset pack retrieval.

RetrieveAssetPackBatchAsync

PlayAssetPackBatchRequest RetrieveAssetPackBatchAsync(
  IList< string > assetPackNames
)

Starts a PlayAssetPackBatchRequest to retrieve the specified asset packs.

Downloads the asset packs if the latest versions aren't already available on disk.

After download, the assets and/or AssetBundles contained in the asset pack are not loaded into memory. To load them use PlayAssetPackRequest.GetAssetLocation or PlayAssetPackRequest.LoadAssetBundleAsync on the values of the PlayAssetPackBatchRequest.Requests dictionary.

Details
Parameters
assetPackNames
A list of requested asset packs.
Exceptions
ArgumentException
Throws if assetPackNames contains duplicate entries.
Returns
A request object used to monitor the asynchronous asset pack batch retrieval.

ShowCellularDataConfirmation

PlayAsyncOperation< ConfirmationDialogResult, AssetDeliveryErrorCode > ShowCellularDataConfirmation()

Shows a confirmation dialog for all currently downloading asset packs that are AssetDeliveryStatus.WaitingForWifi.

If the user accepts the dialog, then those asset packs are downloaded over cellular data.

A PlayAssetBundleRequest is set to AssetDeliveryStatus.WaitingForWifi if the user is currently not on a Wi-Fi connection and the AssetBundle is large or the user has set their download preference in the Play Store to only download apps over Wi-Fi. By showing this dialog, the app can ask the user if they accept downloading the asset packs over cellular data instead of waiting for Wi-Fi.

Details
Returns
A PlayAsyncOperation{ConfirmationDialogResult, AssetDeliveryErrorCode} that completes once the dialog has been accepted, denied, or closed.