【发布时间】:2019-12-12 00:37:13
【问题描述】:
我正在尝试将原生支付库集成到 react 原生应用程序中。
图书馆需要这样的视图设置来处理支付结果。
库引发下一个错误
Calling startActivity() from outside of an Activity context requires the FLAG_ACTIVITY_NEW_TASK flag. Is this really what you want?
不知道是不是我的配置错误,原生库演示应用运行正常。 :( 支付响应意图尝试加载活动,但显然找不到它。
更新
失败的库函数是:
String appId = context.getPackageName() + "." + callbackSchema;
Intent intent = new Intent(appId);
intent.putExtra(ConstantUtil.RETURNED_JSON_KEY,json);
context.startActivity(intent); // <- this call raises the error
更新 最后我让它工作了。我是这样传递上下文的:
getReactApplicationContext()
我通过这样的上下文解决了它:
getCurrentActivity()
在调试中,我得到了这个值:
但错误仍在提高:(
有什么想法吗?
【问题讨论】:
标签: java android react-native android-intent