i am building an android app using google drive api.First i get resourceId of a folder ("shared with me with edit access") using files:list rest api.i get Folder
Id="0B6DwkfjCNXHYflJVOGdnbFU0QkxfU25NbHV5UjNfVmNlNWhhcllnbktmNDNReEhuMm83X0E"
public class MainActivity extends BaseDemoActivity {
@Override
public void onConnected(Bundle connectionHint) {
super.onConnected(connectionHint);
Drive.DriveApi.fetchDriveId(getGoogleApiClient(),"0B6DwkfjCNXHYflJVOGdnbFU0QkxfU25NbHV5UjNfVmNlNWhhcllnbktmNDNReEhuMm83X0E")
.setResultCallback(idCallback);
}
final private ResultCallback<DriveIdResult> idCallback = new ResultCallback<DriveIdResult>() {
@Override
public void onResult(DriveIdResult result) {
if (!result.getStatus().isSuccess()) {
showMessage("Cannot find DriveId. Are you authorized to view this file?");
return;
}
Log.i("driveId is: ", result.toString());
showMessage("Drive Id is: "+result.toString());
DriveId driveId = result.getDriveId();
Log.i("drive Id is",driveId.toString());
//showMessage("Drive Id is: " + driveId.toString());
/* DriveFile ff = driveId.asDriveFile();
ff.getMetadata(getGoogleApiClient()).setResultCallback(metadataRetrievedCallback);
*/
/* DriveFolder folder = driveId.asDriveFolder();
Query query = new Query.Builder()
.addFilter(Filters.eq(SearchableField.MIME_TYPE, "text/plain"))
.build();
folder.queryChildren(getGoogleApiClient(), query)
.setResultCallback(metadataCallback);*/
}
};
ResultCallback<DriveResource.MetadataResult> metadataRetrievedCallback = new
ResultCallback<DriveResource.MetadataResult>() {
@Override
public void onResult(DriveResource.MetadataResult result) {
if (!result.getStatus().isSuccess()) {
showMessage("Problem while trying to fetch metadata");
return;
}
Metadata metadata = result.getMetadata();
showMessage("Metadata succesfully fetched. Title: " + metadata.getTitle());
}
};
}
i set up the project as described in google drive android api.but when i run my code i am getting in callback error "Cannot find DriveId. Are you authorized to view this file?"