javaandroidxposed

how to hook function with xposed?


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?


Solution

  • 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()");
        }
    );