0
  • I won't display firebase storage pdf file in app

        <WebView  xmlns:android="http://schemas.android.com/apk/res/android" style="@style/layout_match_wrap" android:id="@+id/webVi"/>
    

  reView.setVisibility(WebView.VISIBLE);
  reView.getSettings().setAllowFileAccess(true);
  reView.setWebViewClient(new AppWebView());
  reView.getSettings().setJavaScriptEnabled(true);
  reView.getSettings().setUseWideViewPort(true);
  reView.loadUrl(url);

above code i am using for display pdf but still not open.

KENdi
  • 7,576
  • 2
  • 16
  • 31

1 Answers1

0

try this:

String url = "http://www.axmag.com/download/pdfurl-guide.pdf";
 webView = (WebView) findViewById(R.id.webView);
 webView.getSettings().setJavaScriptEnabled(true);
 webView.loadUrl("http://drive.google.com/viewerng/viewer?embedded=true&url=" + url);
Bhupat Bheda
  • 1,968
  • 1
  • 8
  • 13
  • That's already answered in the duplicate post that's flagged, by the way. – OneCricketeer Apr 25 '17 at 12:38
  • thanks for reply but i am using firebase url like: https://firebasestorage.googleapis.com/v0/b/o/QoeRpRpZYOXXjvjL0hjt8ghrkl53%2FResume%2Fpavithra.resume.docx?alt=media&token=acf2db1e-fa0e-46d0-a8bc-3618b8c4a505 – kirankumar791 Apr 25 '17 at 12:40
  • Firebase Storage download URLs are just URLs. They don't require any special treatment in this scenario. – Frank van Puffelen Apr 25 '17 at 13:22
  • thanks for reply i am using url but not able to view pdf content in android app, why it is like that, but same link i try to past it in chrome browser it will directly download the file ,but firefox browser it will ask pop-up like save,download. – kirankumar791 Apr 26 '17 at 04:55