Get app to foreground on API response android platform.

I am working on some blockchain stuff. For transaction purpose I have to jump on some other app and come back to Unreal App after Transaction API response. To jump to other app I am using LaunchURL node which is working fine, to jump back to Unreal App I am using some Java code using JNI which will be triggered on API response:

public void JumpBackToUnreal()
{
	ActivityManager am = (ActivityManager) getSystemService(Context.ACTIVITY_SERVICE);
	if (am.getAppTasks().size() > 0) {
	ActivityManager.AppTask AppTask = am.getAppTasks().get(0);
	int taskId = 0;
	if (android.os.Build.VERSION.SDK_INT >= android.os.Build.VERSION_CODES.Q) {
	taskId = AppTask.getTaskInfo().taskId;
	}
	am.moveTaskToFront(taskId, 0);
	}
}

The above code is working fine for raw android app made in Android Studio.
I am able to jump to other app but cannot jump back to Unreal App. My best guess is while Unreal App is in background it is not getting API response hence unable to trigger JumpBackToUnreal function.
Kindly mention if any solution available.