0

My app has a link to open a pdf using:

Intent.ACTION_VIEW, Uri.parse("http://linkgoeshere/filename.pdf")

this works fine when the user wants to see the pdf the first time. however i dont want the user to download the file over and over again when it is already available on the device. So, how do I check if the file already exists (afaik the download path depends on the used device/ android version), and in case it exists how do i open it directly instead of downloading.

jay
  • 109
  • 8

1 Answers1

1

Android has a default download directory:

Environment.getExternalStoragePublicDirectory(Environment.DIRECTORY_DOWNLOADS);

You can check this directory for the downloaded file (API >= 8)

Opening a pdf file is described here: https://stackoverflow.com/questions/10530416

Community
  • 1
  • 1
Andi Krusch
  • 1,383
  • 8
  • 6