public void handleLoadPackage(final XC_LoadPackage.LoadPackageParam loadPackageParam) throws Throwable {
Log.d("handle",loadPackageParam.packageName);
if (loadPackageParam.packageName.equals("com.example.ming.xposedtest")) {
Class clazz = loadPackageParam.classLoader.loadClass("com.example.ming.xposedtest.MainActivity");
findAndHookMethod(clazz, "toastMessage", new XC_MethodHook() {
protected void beforeHookedMethod(MethodHookParam param) throws Throwable {
super.beforeHookedMethod(param);
}
protected void afterHookedMethod(MethodHookParam param) throws Throwable {
param.setResult("you have been kidnapped");
}
});
}
}
The Xposed has been loaded successfully, I can hook my own method and update it's return value to "you have been kidnapped", and it's package name has printed in dlog, but there's no any other package name showed up, and i don't know why. Anyone can give a tips to me? I'll be very appreciated
Now i found that when i post log with XposedBridge, there will be logs printed in XposedInstaller's log.But a new problem happened,i could hook the target class but not the exact method in this class which is onCreate(). Here is the code below:
findAndHookMethod(Application.class, "attach", Context.class, new XC_MethodHook() { @Override protected void afterHookedMethod(MethodHookParam param) throws Throwable { super.afterHookedMethod(param); Context mContext = (Context) param.args[0]; ClassLoader classLoader = mContext.getClassLoader(); Class w; Class webtoonViewerActivity; try { webtoonViewerActivity = classLoader.loadClass("com.xunmeng.merchant.ui.MainFrameTabActivity"); XposedBridge.log("webtoonViewerActivity"+webtoonViewerActivity.getName()); }catch (Exception e) { return; }
findAndHookMethod(webtoonViewerActivity, "onCreate", new XC_MethodHook() {
@Override
protected void beforeHookedMethod(MethodHookParam param) throws Throwable {
super.beforeHookedMethod(param);
XposedBridge.log("beforeHookedMethod"+param.toString());
}
@Override
protected void afterHookedMethod(MethodHookParam param) throws Throwable {
super.afterHookedMethod(param);
param.setResult(true);
}
});
}
});