4

I'm downloading a PDF in my application using:

Intent browserIntent = new Intent(Intent.ACTION_VIEW, Uri.parse("*url for your pdf*"));
startActivity(browserIntent);

This opens an activity that looks like a webview and begins the pdf download in the drop down menu. I'd like to keep the drop down download notification but is there a way to close the webview activity once the download starts? Or even better keep the webview from popping up in the first place?

HighLife
  • 4,218
  • 7
  • 40
  • 56

1 Answers1

2

Instead of calling a Uri intent, you could download the file to the sd card if it is not already there (using notification for progress), then call action_view on the file. That should open it directly in the preferred PDF viewer.

Community
  • 1
  • 1
NoBugs
  • 9,310
  • 13
  • 80
  • 146