Get Web View Activity Using PDF Link Action_view

I upload a PDF file to my application using:

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

This opens up an action that looks like a web view and starts the pdf download from the drop-down menu. I would like to keep the download notification drop down, but is there a way to close the web browsing activity after the download starts? Or is it even better to keep web browsing in the first place?

+4
source share
1 answer

Instead of calling the Uri intent, you could upload the file to the SD card, if it was not already (using progress notification), then call action_view on the file. This should open it directly in your preferred PDF viewer.

+2
source

Source: https://habr.com/ru/post/1387893/


All Articles