8. Download Contents

You can download content's zip_file through the REST API, using each content download URL. For the zip_file URL, you need to first request a signed URL.

The signed URL can be generated through ARGSession.auth().requestSignedUrl and be obtained by calling ARGAuth.Callback(). Using this URL, you can download contents.

Below is sample code to generate the signed URL.

Java
Kotlin
Java
argsession.auth().requestSignedUrl(item.zipFileUrl, item.title, item.type, new ARGAuth.Callback() {
@Override
public void onSuccess(String url) {
// Using obtained signed url, request download.
requestDownload(path, url, item.uuid, isArItem);
}
@Override
public void onError(Throwable e) {
if (e instanceof SignedUrlGenerationException) {
Log.e(TAG, "SignedUrlGenerationException !! ");
} else if (e instanceof NetworkException) {
Log.e(TAG, "NetworkException !!");
}
}
});
Kotlin
argsession.auth().requestSignedUrl(item.zipFileUrl, item.title, item.type, object : ARGAuth.Callback {
override fun onSuccess(url: String) {
// Using obtained signed url, request download.
requestDownload(path, url, item, isArItem)
}
override fun onError(e: Throwable) {
if (e is SignedUrlGenerationException) {
Log.e(TAG, "SignedUrlGenerationException !! ")
} else if (e is NetworkException) {
Log.e(TAG, "NetworkException !!")
}
}
})