在Android中使用Box时,如何获取最近上传的文件的共享链接。
mFileApi.getCreateSharedLinkRequest(fileId).setCanDownload(true)
.setAccess(BoxSharedLink.Access.OPEN)
.toTask().addOnCompletedListener(new BoxFutureTask.OnCompletedListener<BoxFile>() {
@Override
public void onCompleted(BoxResponse<BoxFile> response) {
if (response.isSuccess()) {
BoxFile boxFile = response.getResult();
String downloadUrl = boxFile.getSharedLink().getDownloadURL();
Log.e("downloadurl", "onCompleted: " + downloadUrl);
//This return me a web link to show the Box page to download the file
} else {
Toast.makeText(MainActivity.this, "error while getting sharelink", Toast.LENGTH_SHORT).show();
}
}
}).run();