Purge the download

On user input, the client application can retrieve information from a downloaded asset to purge. Based on that information (PRM Syntax, PRM Content ID, or privately defined content ID), the client application can erase related licences from the PAK.

In parallel or sequentially, the client application can remove the downloaded asset by calling removeDownload(). The removal is potentially time consuming, so the operation is asynchronous.

The purge download operation takes place when the user decides to delete a downloaded asset on their device.

If an Android M user declines the WRITE_EXTERNAL_STORAGE permission, the SDK produces a download error with a state of FAILED and a reason of ERROR_NO_STORAGE_ACCESS.

Example code

The following code example shows how to purge a downloaded asset and its related license:

public void removeAssetByUUID(String xUUID) {
  // Retrieve the download using its UUID.
  Download download mDownloadManager.getDownloadByUUID(xUUID);
  if (download == null) {
    Log.w(TAG, "No download to remove for UUID: " + xUUID); 
    return;
  }



  // All the licenses have been purged. Remove the asset.
  boolean removed = mDownloadManager.removeDownload(xUUID);
  if (!removed) {

    Log.w(TAG, "Couldn't remove download with UUID: " + xUUID); 
  }
}