2

In accordance with advice of many I'm trying to use goolge docs to show a pdf in a WebView.

Here is my code:

@SuppressLint("SetJavaScriptEnabled")
public void setDocumentPath(final String path) {
    WebView webView = (WebView) findViewById(R.id.webview);
    webView.getSettings().setJavaScriptEnabled(true);
    webView.getSettings().setPluginsEnabled(true);
    webView.loadUrl("https://docs.google.com/viewer?url=http://www.selab.isti.cnr.it/ws-mate/example.pdf");
}

The PDF is just some example I found online. It works in my browser, but on my android emulator and device it displays a "Webpage not available".

Both are running android 4.0.

Is there anything obvious I'm missing? Thank you.

MrFox
  • 1,244
  • 1
  • 11
  • 24

1 Answers1

3

And in case someone is beating their head against the wall in a similar situation, it's a case of forgotten permissions.

<uses-permission android:name="android.permission.INTERNET" /> 
MrFox
  • 1,244
  • 1
  • 11
  • 24