I have uploaded a Pdf file to firebase storage, after uploading the pdf file to firebase storage, I am getting the download url. Now I want to open the pdf file in webview in my android application.
Below is the url I am getting after uploading the pdf file to firebase storage.
Below is my method for open pdf in webview
private void loadWebUrl(String url) {
myWebView.setBackgroundColor(Color.TRANSPARENT);
myWebView.getSettings().setJavaScriptEnabled(true);
settings.setAllowFileAccessFromFileURLs(true);
settings.setAllowUniversalAccessFromFileURLs(true);
settings.setBuiltInZoomControls(true);
//url = "http://narsun.pk/profile.pdf";
if (url!=null&&!url.isEmpty()) {
myWebView.loadUrl("https://docs.google.com/viewerng/viewer?url="+url);
//myWebView.loadUrl("http://drive.google.com/viewerng/viewer?embedded=true&url="+url);
}else {
Utils.showToast(mActivity,"Sorry No Pdf url Exist!");
mActivity.onBackPressed();
}
}
Please help me where I am wrong! Thanks