private static void HookLocation(ClassLoader classLoader) throws ClassNotFoundException {
//坐标拾取系统 https://lbs.qq.com/getPoint/
double latitude = 0.0;
double longitude = 0.0;
Class clazz = classLoader.loadClass(
"com.tencent.map.geolocation.sapp.TencentLocationManager");
XposedHelpers.findAndHookMethod(clazz, "requestLocationUpdates",
"com.tencent.map.geolocation.sapp.TencentLocationRequest",
"com.tencent.map.geolocation.sapp.TencentLocationListener", new XC_MethodHook() {
@Override
protected void beforeHookedMethod(MethodHookParam param) throws Throwable {
XposedBridge.log("requestLocationUpdates");
Class tencentLocationListenerClass = param.args[1].getClass();
XposedHelpers.findAndHookMethod(tencentLocationListenerClass,
"onLocationChanged",
"com.tencent.map.geolocation.sapp.TencentLocation",
int.class, String.class, new XC_MethodHook() {
@Override
protected void beforeHookedMethod(MethodHookParam param) throws Throwable {
Class tencentLocation = param.args[0].getClass();
XposedHelpers.findAndHookMethod(tencentLocation,
"getLatitude",
new XC_MethodHook() {
@Override
protected void afterHookedMethod(MethodHookParam param) throws Throwable {
XposedBridge.log("requestLocationUpdates.getLatitude:"+ param.getResult());
param.setResult(latitude);
}
});
XposedHelpers.findAndHookMethod(tencentLocation,
"getLongitude",
new XC_MethodHook() {
@Override
protected void afterHookedMethod(MethodHookParam param) throws Throwable {
XposedBridge.log("requestLocationUpdates.getLongitude:"+ param.getResult());
param.setResult(longitude);
}
});
}
});
}
}
);
} |