Open qxtqxt96 opened 7 years ago
You can send an Intent to your app.
You may need to get a context. Try to get system context by hooking.
@TonyQi1996 You can use something like this https://github.com/wanam/YouTubeAdAway/blob/master/src/ma/wanam/youtubeadaway/Xposed.java#L44 to get a context.
@wanam Thanks very much. Now i try doing that. ( I deleted my comment just now which mentioned you. Because i wanted to revoice my ideas. And suddenly i saw your respones. Thank you for your rapid answers.)
@wanam I made it. Is that a system context? But there is a new problem after starting my activity. When i click "back", it can't back to the application which includes the hooked method. The method is still hooked and my activity is started. Whether the problem is the hooked method?
findAndHookMethod(Camera.class, "startPreview", new XC_MethodHook() {
@Override
protected void beforeHookedMethod(MethodHookParam param) throws Throwable {
super.beforeHookedMethod(param);
try {
if (context == null) {
Object activityThread = XposedHelpers.callStaticMethod(
XposedHelpers.findClass("android.app.ActivityThread", null), "currentActivityThread");
context = (Context) XposedHelpers.callMethod(activityThread, "getSystemContext");
}
if (context != null ) {
Intent intent = new Intent();
intent.setClassName("com.xys.zxinglib", "com.xys.zxinglib.ScanQRCodeActivity");
intent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
context.startActivity(intent);
}
} catch (Throwable t) {
XposedBridge.log(t);
}
}
});
In my class which implements IXposedHookLoadPackage, i try
So when i have hooked this function in a test application, i want to start my application which includes this class. How can i do it ?