0
我有一個android應用程序,它將圖像保存到Google Drive中,並將該鏈接分享到我的Google App Engine服務器(python)。如何以編程方式共享Android上的谷歌驅動器鏈接?
// Create client
mGoogleApiClient = new GoogleApiClient.Builder(mContext)
.addApi(Drive.API)
.addScope(Drive.SCOPE_FILE)
.addConnectionCallbacks(this)
.addOnConnectionFailedListener(this)
.build();
// handling results after uploading
final DriveOperationResult<Metadata> driveOperationResultHandler = new DriveOperationResult<Metadata>() {
@Override
public void onDriveOperationSucceeded(Metadata result) {
try {
// Successfully fetched metadata
onSuccess(driveId,
result.getOriginalFilename(),
result.getWebContentLink(),
result.getWebViewLink(),
result.getAlternateLink(),
result.getEmbedLink());
} finally {
mGoogleDriveClient.disconnectAsync();
}
}
注: result.getEmbedLink()始終返回null。另外,如果用戶已登錄,則無法訪問result.getAlternateLink()和result.getWebContentLink()。
如何編程分享安卓即文件,讓所有人都可以查看(假定用戶是與OK)
您是否嘗試過setEmbedLink(),然後getEmbedLink()? – Dziugas
試試這個[SO線程](http://stackoverflow.com/questions/15202163/get-shared-link-through-google-drive-api)。它可能會提供更多的見解。 – noogui