How to hook the abstract method getUserAgentString?

341 Views Asked by At

I want to hook WebSettings's getUserAgentString system method. But this method is abstract. In fact, WebSettings itself is an abstract class. Hooking the method gives the following exception.

java.lang.IllegalArgumentException: Cannot hook abstract methods: public abstract java.lang.String android.webkit.WebSettings.getUserAgentString()

Usually we call new WebView(this).getSettings().getUserAgentString(), but I never know what the implementing subclass is. So what can I do in this case?

0

There are 0 best solutions below