how to hook function with xposed?

525 Views Asked by At

for example,i decompile the app and want to hook function with xposed,how can i do that?

package com.my.app;
public class myClass 
{
public static int myFunction() 
   {
      //do something inside
   }   
}

how to hook "myFunction" with xposed?

1

There are 1 best solutions below

0
Robert On BEST ANSWER

Have you tried to simply adapt the available examples to your class and method?

XposedHelpers.findAndHookMethod("com.my.app.myClass", lpparam.classLoader, "myFunction", new XC_MethodHook() {
    @Override
    protected void beforeHookedMethod(MethodHookParam param) throws Throwable {
        XposedBridge.log("before myFunction()");
    }
    @Override
    protected void afterHookedMethod(MethodHookParam param) throws Throwable {
        XposedBridge.log("after myFunction()");
    }
);