简体   繁体   English

如何在Android上以编程方式共享Google Drive链接?

[英]How to programmatically share a google drive link on android?

I have an android app that saves an image into the Google Drive and shares the weblink to my Google App Engine server (python). 我有一个Android应用程序,可将图像保存到Google云端硬盘中,并共享与我的Google App Engine服务器(python)的网络链接。

    // 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();
        }
    }

Note: result.getEmbedLink() always returns null. 注意: result.getEmbedLink()始终返回null。 Also, result.getAlternateLink() and result.getWebContentLink() are not accessible not accessible if the user is logged-in. 另外,如果用户已登录,则无法访问result.getAlternateLink()和result.getWebContentLink()。

How do I programmatically share the file from Android ie, make it viewable by everyone (assuming the user is OK with that) 我如何以编程方式从Android共享文件,即使每个人都可以查看该文件(假设用户对此表示同意)

Google Drive的Android API无法使用。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM