-
-
Save gauravssnl/f597ee502c7d5b65de007dcb7f50280c to your computer and use it in GitHub Desktop.
Hooking into any class in Google Play Services
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package com.versobit.kmark.gist; | |
import android.app.Application; | |
import android.content.Context; | |
import de.robv.android.xposed.IXposedHookLoadPackage; | |
import de.robv.android.xposed.XC_MethodHook; | |
import de.robv.android.xposed.callbacks.XC_LoadPackage; | |
import static de.robv.android.xposed.XposedHelpers.findAndHookMethod; | |
public class XHookGms implements IXposedHookLoadPackage { | |
@Override | |
public void handleLoadPackage(final XC_LoadPackage.LoadPackageParam lpp) throws Throwable { | |
if(!"com.google.android.gms".equals(lpp.packageName)) { | |
return; | |
} | |
findAndHookMethod(Application.class, "attach", Context.class, new XC_MethodHook() { | |
@Override | |
protected void afterHookedMethod(MethodHookParam param) throws Throwable { | |
// Hook here (as normal) using lpp.classLoader | |
} | |
}); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment