I want to open remotly and offline a pdf file in an android webview which it locate on my NAS in my Home LAN.
I tried this but i had a network error in the webview (Web page not available) :
public void OpenPDF(String Path) {
try {
WebView webView=new WebView(ListDir.this);
webView.getSettings().setJavaScriptEnabled(true);
webView.getSettings().setPluginState(PluginState.ON);
webView.setWebViewClient(new Callback());
Log.i("",""+"file://"+Path);
webView.loadUrl("file:///"+Path);
setContentView(webView);
}
catch(Exception e) {
Toast(""+e);
}
}
private class Callback extends WebViewClient {
@Override
public boolean shouldOverrideUrlLoading(
WebView view, String url) {
return(false);
}
}
where Path = 192.168.0.254/Disque dur/AffichePDF.pdf
The Log.i = 07-23 15:15:43.523: I/(7988): file:///192.168.0.254/Disque dur/AffichePDF.pdf
Chrome android tells ERR : 10 ERR_ACCESS_DENIED on my s3 and Network error on default browser. Does any configuration should be done on the device to use file:/// ?
The path file:///192.168.0.254/Disque dur/AffichePDF.pdf works fine on my PC and i can navigate and list files on my NAS from my app.
Somebody knows a tip to do that working ?
Thanks