Reputation: 1345
The web application that I am developing has a link to generate a document in pdf format. On clicking the link the server-side code generates the PDF and streams it back to the browser with content type set as "application/pdf". This is working as expected in all the browsers except the android stock/default browser. On clicking the link in the stock browser, the pdf download starts in background. The user has to go to the notification area to actually open then pdf.
Is there a way to make the browser directly open the pdf instead of doing the background process?
Upvotes: 1
Views: 1631
Reputation: 1576
here's ur answer: just append ur URL with google url and send it to browser;
case R.id.btnSchoolMenuView:
Log.d(TAG, "Lunch Btn "+lunchMenuUrl);
String googleUrl = "http://docs.google.com/gview?embedded=true&url=";
Log.d(TAG, googleUrl + lunchMenuUrl);
Intent browserIntent = new Intent(Intent.ACTION_VIEW, Uri.parse(googleUrl + lunchMenuUrl));
startActivity(browserIntent);
break;
Upvotes: 1