0

My Android app uses a file that the user downloads, using a Web browser.

(Yes, I know that there are ways that an Android app can download a file itself, without sending the user to a Web browser. I cannot do that in this app, because the file is hosted on Microsoft's OneDrive cloud storage. And, yes, I know that there is a OneDrive API that can do that, but my understanding is that the user would need to know my OneDrive password before the API could download files.)

I would like to prevent my app from attempting to open a file while the browser is still downloading it.

I tried getting a write lock on the file, using FileChannel.tryLock(), but this granted a lock even while the browser was still downloading the file. (Apparently locking is voluntary.)

Any other ideas? Thanks.

Lew Lasher
  • 81
  • 5
  • 1
    And your code please? – Mr. Concolato Dec 20 '14 at 15:15
  • You could use DropBox. No API is needed to download a file from a public shared folder. I did this in the past by simply using a normal HTTP file download (no WebView at all). See this post: http://stackoverflow.com/questions/3028306/download-a-file-with-android-and-showing-the-progress-in-a-progressdialog – Phantômaxx Dec 20 '14 at 15:21
  • Thanks for the comment about DropBox. It turns out that I am taking advantage of the hugely larger free storage space on OneDrive. – Lew Lasher Dec 20 '14 at 20:25

0 Answers0