I am developing an app that has an embbed webpage that runs javascript. The javascript executes requests, and I would like to intercept them. I need this because I need the user to use the webview without an internet connection. I want to save the requests and execute later when he is connected.
What I have tried:
WebViewClient:
this class hasshouldInterceptRequest
but it only provides the url, I need more info (headers and body).mWebview.setWebViewClient(new WebViewClient() { @Override public WebResourceResponse shouldInterceptRequest(WebView view, String url) { return super.shouldInterceptRequest(view, url); } });
Setting a custom proxy and creating a SocketServer to listen to the proxy port and intercept the request. This approach is too risky for me.
Therefore I would like to know if there is another way. Any help is greatly appreciated.