Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    text
    copied!<p>According to changes made on DropBox metioned here: <a href="https://www.dropbox.com/help/16/en" rel="noreferrer">https://www.dropbox.com/help/16/en</a> There would be no more Public folders, instead access to files can be done via Share Link.</p> <p>If you use Android DropBox Core Api then shared link can be retrieved this way:</p> <pre><code>// Get the metadata for a directory Entry dirent = mApi.metadata(mPath, 1000, null, true, null); for (Entry ent : dirent.contents) { String shareAddress = null; if (!ent.isDir) { DropboxLink shareLink = mApi.share(ent.path); shareAddress = getShareURL(shareLink.url).replaceFirst("https://www", "https://dl"); Log.d(TAG, "dropbox share link " + shareAddress); } } </code></pre> <p><strong>UPDATE: 2014/07/20 by Dheeraj Bhaskar</strong> Use the following helper function alongwith the above function. Since DropBox started to send shortened links it is little bit more problematic to get proper link. For now, I am using this method :</p> <p>We simply load the URL, follow the redirects and get the new URL.</p> <pre><code> String getShareURL(String strURL) { URLConnection conn = null; String redirectedUrl = null; try { URL inputURL = new URL(strURL); conn = inputURL.openConnection(); conn.connect(); InputStream is = conn.getInputStream(); System.out.println("Redirected URL: " + conn.getURL()); redirectedUrl = conn.getURL().toString(); is.close(); } catch (MalformedURLException e) { Log.d(TAG, "Please input a valid URL"); } catch (IOException ioe) { Log.d(TAG, "Can not connect to the URL"); } return redirectedUrl; } </code></pre> <blockquote> <p><strong>Note:</strong> All of this should be done of course in AsyncTask or Thread. This will produce proper links ready to download</p> </blockquote> <p><strong>Update 2014/07/25: Change in dropbox share URLs</strong><br> A heads-up on the kind of URLs to expect<br> <strong>From the Dropbox team:</strong></p> <blockquote> <p>We wanted to give you a heads up about an upcoming change to the URL structure of Dropbox shared links. While not part of the API, the change could affect apps that manipulate the URLs returned from the /shares endpoint or the "preview" link type returned by the Chooser Drop-in.</p> <p>Links returned will now have a ?dl=0 appended to them.</p> <p>E.g., instead of <a href="https://www.dropbox.com/s/99eqbiuiepa8y7n/Fluffbeast.docx" rel="noreferrer">https://www.dropbox.com/s/99eqbiuiepa8y7n/Fluffbeast.docx</a>, you'll receive URLs like this link <a href="https://www.dropbox.com/s/99eqbiuiepa8y7n/Fluffbeast.docx?dl=0" rel="noreferrer">https://www.dropbox.com/s/99eqbiuiepa8y7n/Fluffbeast.docx?dl=0</a>.</p> </blockquote>
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload