In Google Drive, I'm getting this issue:
Status{statusCode=Drive item not found, or you are not authorized to access it., resolution=null}
for getting list of files from the Google Drive folder.
I am using the Google Drive Android SDK. Can you please help me on this issue?
Here is the source code which I am following:
Drive.DriveApi.fetchDriveId(mGoogleApiClient, "DriveId:CAESABiErgEg3t2Dj4VVKAE=").setResultCallback(new ResultCallback<DriveApi.DriveIdResult>() {
@Override
public void onResult(DriveApi.DriveIdResult result) {
Log.d(TAG, "Result: " + result.getStatus().toString());
if (!result.getStatus().isSuccess()) {
Log.d(TAG, "Cannot find DriveId. Are you authorized to view this file?");
// showMessage("Cannot find DriveId. Are you authorized to view this file?");
return;
}
DriveId driveId = result.getDriveId();
DriveFolder folder = driveId.asDriveFolder();
Query query = new Query.Builder()
.addFilter(Filters.eq(SearchableField.MIME_TYPE, "audio/*"))
.build();
folder.queryChildren(mGoogleApiClient, query)
.setResultCallback(new ResultCallback<DriveApi.MetadataBufferResult>() {
@Override
public void onResult(DriveApi.MetadataBufferResult result) {
if (!result.getStatus().isSuccess()) {
Log.d(TAG, "Problem while retrieving files");
// showMessage("Problem while retrieving files");
return;
}
Log.d(TAG, "result.getMetadataBuffer(): " + result.getMetadataBuffer());
/*mResultsAdapter.clear();
mResultsAdapter.append(result.getMetadataBuffer());
showMessage("Successfully listed files.");*/
}
});
}
});