【发布时间】:2021-10-08 15:24:26
【问题描述】:
我试图从 Java 中的 onNewIntent 函数中打开一个页面。但是,它不起作用。我做错了什么?
Java
@Override
protected void onNewIntent(Intent intent) {
super.onNewIntent(intent);
if (Intent.ACTION_VIEW.equals(intent.getAction())) {
Uri uri = intent.getData();
String paymentId = uri.getQueryParameter("id");
intent.putExtra("paymentId", paymentId);
FlutterEngine flutterEngine = new FlutterEngine(this);
flutterEngine.getDartExecutor().executeDartEntrypoint(
DartEntrypoint.createDefault()
);
flutterEngine.getNavigationChannel().pushRoute("process");
}
}
颤动
Future<void> main(List<String> args) async {
WidgetsFlutterBinding.ensureInitialized();
runApp(MaterialApp(
debugShowCheckedModeBanner: false,
initialRoute: "/",
routes: {
'/': (context) => Init(),
'/process': (context) => StartProcess(),
},
));
}
我要做的是打开浏览器进行付款。当浏览器关闭时,我返回到 onNewIntent 函数。从那里我想要颤振打开流程页面。也许还有另一种方法可以完成这项工作?
【问题讨论】: