API Lua
API Lua


pad

Version: stable

FUNCTIONS
pad.cancel()
pad.fetch()
pad.remove_pack()
pad.get_pack_state()
pad.get_pack_location()
pad.get_pack_bytes_downloaded()
pad.get_pack_error_code()
pad.get_pack_status()
pad.get_pack_total_bytes_to_download()
pad.get_pack_transfer_progress_percentage()
pad.show_confirmation_dialog()
pad.set_listener()
CONSTANTS
EVENT_PACK_STATE_UPDATED
EVENT_PACK_STATE_ERROR
EVENT_REMOVE_PACK_COMPLETED
EVENT_REMOVE_PACK_CANCELED
EVENT_REMOVE_PACK_ERROR
EVENT_DIALOG_CONFIRMED
EVENT_DIALOG_DECLINED
EVENT_DIALOG_CANCELED
EVENT_DIALOG_ERROR
STATUS_UNKNOWN
STATUS_PENDING
STATUS_DOWNLOADING
STATUS_TRANSFERRING
STATUS_COMPLETED
STATUS_FAILED
STATUS_CANCELED
STATUS_WAITING_FOR_WIFI
STATUS_NOT_INSTALLED
STATUS_REQUIRES_USER_CONFIRMATION
ERRORCODE_ACCESS_DENIED
ERRORCODE_API_NOT_AVAILABLE
ERRORCODE_APP_NOT_OWNED
ERRORCODE_APP_UNAVAILABLE
ERRORCODE_CONFIRMATION_NOT_REQUIRED
ERRORCODE_DOWNLOAD_NOT_FOUND
ERRORCODE_INSUFFICIENT_STORAGE
ERRORCODE_INTERNAL_ERROR
ERRORCODE_INVALID_REQUEST
ERRORCODE_NETWORK_ERROR
ERRORCODE_NETWORK_UNRESTRICTED
ERRORCODE_NO_ERROR
ERRORCODE_PACK_UNAVAILABLE
ERRORCODE_PLAY_STORE_NOT_FOUND
ERRORCODE_UNRECOGNIZED_INSTALLATION

Functions

pad.cancel()

pad.cancel(pack_name)

Requests to cancel the download of the specified asset packs.

PARAMETERS

pack_name string

pad.fetch()

pad.fetch(pack_name)

Requests to download the specified asset pack.

PARAMETERS

pack_name string

pad.remove_pack()

pad.remove_pack(pack_name)

Deletes the specified asset pack from the internal storage of the app.

PARAMETERS

pack_name string

pad.get_pack_state()

pad.get_pack_state(pack_name)

Requests download state and details for the specified asset pack. This is an asynchronous function and will send a `PACK_STATE_UPDATED` event once the new state is available.

PARAMETERS

pack_name string

pad.get_pack_location()

pad.get_pack_location(pack_name)

Returns the location of the specified asset pack on the device or an empty string if this pack is not downloaded.

PARAMETERS

pack_name string

RETURNS

strin

pad.get_pack_bytes_downloaded()

pad.get_pack_bytes_downloaded(pack_name)

Returns the total number of bytes already downloaded for the pack. Note that you must have called the `get_pack_state()` function first and wait for a `PACK_STATE_UPDATED` event before calling this function.

PARAMETERS

pack_name string

RETURNS

bytes_downloade

pad.get_pack_error_code()

pad.get_pack_error_code(pack_name)

Returns the error code for the pack, if Play has failed to download the pack. Note that you must have called the `get_pack_state()` function first and wait for a `PACK_STATE_UPDATED` event before calling this function.

PARAMETERS

pack_name string

RETURNS

error_cod

pad.get_pack_status()

pad.get_pack_status(pack_name)

Returns the download status of the pack. Note that you must have called the `get_pack_state()` function first and wait for a `PACK_STATE_UPDATED` event before calling this function.

PARAMETERS

pack_name string

RETURNS

statu

pad.get_pack_total_bytes_to_download()

pad.get_pack_total_bytes_to_download(pack_name)

Returns the total size of the pack in bytes. Note that you must have called the `get_pack_state()` function first and wait for a `PACK_STATE_UPDATED` event before calling this function.

PARAMETERS

pack_name string

RETURNS

bytes_to_downloa

pad.get_pack_transfer_progress_percentage()

pad.get_pack_transfer_progress_percentage(pack_name)

Returns the percentage of the asset pack already transferred to the app. Note that you must have called the `get_pack_state()` function first and wait for a `PACK_STATE_UPDATED` event before calling this function.

PARAMETERS

pack_name string

RETURNS

numbe

pad.show_confirmation_dialog()

pad.show_confirmation_dialog(pack_name)

Shows a dialog that asks the user for consent to download packs Shows a dialog that asks the user for consent to download packs that are currently in either the AssetPackStatus.REQUIRES_USER_CONFIRMATION state or the AssetPackStatus.WAITING_FOR_WIFI state. Will return result in event listener.

PARAMETERS

pack_name string

pad.set_listener()

pad.set_listener(listener)

Set listener to receive events

PARAMETERS

listener function
The function to call (self, event)

Constants

EVENT_PACK_STATE_UPDATED


EVENT_PACK_STATE_ERROR


EVENT_REMOVE_PACK_COMPLETED


EVENT_REMOVE_PACK_CANCELED


EVENT_REMOVE_PACK_ERROR


EVENT_DIALOG_CONFIRMED


EVENT_DIALOG_DECLINED


EVENT_DIALOG_CANCELED


EVENT_DIALOG_ERROR


STATUS_UNKNOWN


STATUS_PENDING


STATUS_DOWNLOADING


STATUS_TRANSFERRING


STATUS_COMPLETED


STATUS_FAILED


STATUS_CANCELED


STATUS_WAITING_FOR_WIFI


STATUS_NOT_INSTALLED


STATUS_REQUIRES_USER_CONFIRMATION


ERRORCODE_ACCESS_DENIED

Download not permitted under the current device circumstances


ERRORCODE_API_NOT_AVAILABLE

The Asset Delivery API isn't available.


ERRORCODE_APP_NOT_OWNED

The app isn't owned by any user on this device.


ERRORCODE_APP_UNAVAILABLE

The requesting app is unavailable.


ERRORCODE_CONFIRMATION_NOT_REQUIRED

Returned if AssetPackManager.showConfirmationDialog(Activity) is called but no asset packs require user confirmation.


ERRORCODE_DOWNLOAD_NOT_FOUND

The requested download isn't found.


ERRORCODE_INSUFFICIENT_STORAGE

Asset pack download failed due to insufficient storage.


ERRORCODE_INTERNAL_ERROR

Unknown error downloading an asset pack.


ERRORCODE_INVALID_REQUEST

The request is invalid.


ERRORCODE_NETWORK_ERROR

Network error.


ERRORCODE_NETWORK_UNRESTRICTED

Returned if AssetPackManager.showCellularDataConfirmation(Activity) is called but no asset packs are waiting for Wi-Fi.


ERRORCODE_NO_ERROR


ERRORCODE_PACK_UNAVAILABLE

The requested asset pack isn't available.


ERRORCODE_PLAY_STORE_NOT_FOUND

The Play Store app is either not installed or not the official version.


ERRORCODE_UNRECOGNIZED_INSTALLATION

The installed app version is not recognized by Play.