androiddropboxdropbox-sdk

Upload File on Dropbox and retrieve uploaded file URL : Android


I have created an application, in which I have to upload media files like image, audio etc. So I am successfully able to upload the file on dropbox but I need the url of uploaded file from dropbox in success of upload. So I can work further by using that url of file.

Please anyone have answer of my question. I want URL of uploaded file once upload is successful

Note :- I am using Dropbox sdk version 3.0.6.


Solution

  • I had a same issue and got the solution using this code below:

                      try {
                           SharedLinkMetadata sharedLinkMetadata = dbxClient.sharing().createSharedLinkWithSettings(metadata.getPathDisplay());
                           System.out.println(sharedLinkMetadata.getUrl());
                       } catch (CreateSharedLinkWithSettingsErrorException ex) {
                           System.out.println(ex);
                       } catch (DbxException ex) {
                           System.out.println(ex);
                       }
    

    Note: If you had tried the same file to make shareable using any site or web, it will give you an exception.