1 | initial version |
To utilize the official SDK to acquire a file from Huawei cloud, follow the steps below:
Drive mDrive = DriveService.getDrive(context, accessToken);
String fileId = "file-id";
StreamContent content = mDrive.files().get(fileId).executeMediaAsInputStream();
Here, DriveService.getDrive()
method returns an instance of the Drive API and mDrive.files().get()
method retrieves the file from Huawei Cloud, with the fileId
parameter being the ID of the file you want to retrieve.
Note: This example assumes you have obtained the necessary permissions and have included the appropriate dependency for the Huawei Cloud SDK in your project.