3

The title says it all. I would like to know about everything what the WebView is asking for. Some weird limitations like not knowing about XHR POST are not acceptable. In other words, something like iOS have in NSURLProtocol. That one is application-wide hook. I don't need such level of control, WebView-instance-specific hook would be good enough. Now, i know that nothing like that exists on Android out of the box. I know about shouldOverrideUrlLoading and shouldInterceptRequest, but it's largely unusable. I need to know about requests (method, HTTP version, headers, you know) not just merely the URL strings. Moreover the intercepting is awkwardly synchronous. What happens if shouldInterceptRequest call is blocked because i need to ask a different server for related resource? It appears to me being designed just for a local resource caching.

On the other hand, i am willing to throw anything at the problem. Some kind of native library, hooking into low level internals? Extending Chromium interfaces with help of an existing project (pwnall, mogoweb)? Reflecting into the existing webkit class privates? Application-specific proxy? Any insights appreciated. I have read through two dozens of existing SO questions. They all either suggest a partial hack (like working around XHR POST deficiency with JavaScript) or it goes unresponded altogether, very often.

Pavel Zdenek
  • 7,146
  • 1
  • 23
  • 38
  • Long-term, you can see if [Mozilla's GeckoView](https://wiki.mozilla.org/Mobile/GeckoView) might have more hooks for what you're seeking. The only one of your listed solutions that I would put much faith in would be the proxy. – CommonsWare Oct 05 '14 at 13:04
  • @CommonsWare: with all respect to Mark Finkle, GeckoView appears to be quite dead horse. It seems to have stalled about a year ago. My listing isn't authoritative, rather a storm of wild thoughts for Android senior brains. So an app-specific proxy should be possible? What's the Google spell for more informations? :) – Pavel Zdenek Oct 05 '14 at 18:14
  • I searched on `android webview proxy`. Note that this is not supported, but it is more likely to be more stable than the other options in your list. – CommonsWare Oct 05 '14 at 18:16

2 Answers2

1

Try with inspeckage:

https://github.com/ac-pm/Inspeckage

It needs Xposed and root access to work. I've been able to see WebView requests from apps. Im figuring out how to recreate them with Python's requests module.

Hope that helps.

Eratsu
  • 21
  • 6
  • The required functionality had to be Playstore publishable, so rooting wouldn't be an option. But thanks for the feedback anyway. – Pavel Zdenek Feb 19 '20 at 08:18
0

If I understand your goal - try:

WebView.setWebContentsDebuggingEnabled(true);

Open Chrome and go to url chrome://inspect/#devices

for details:

https://developers.google.com/web/tools/chrome-devtools/remote-debugging

https://developers.google.com/web/tools/chrome-devtools/remote-debugging/webviews

Arseniy
  • 51
  • 1
  • 6
  • Whilst this may theoretically answer the question, [it would be preferable](//meta.stackexchange.com/q/8259) to include the essential parts of the answer here, and provide the link for reference. – Adrian Mole Feb 16 '20 at 21:40
  • Anyway i was looking for programmatic control, not Chrome debugging. – Pavel Zdenek Feb 19 '20 at 08:19