【问题标题】:pushRoute from Java on new intent not working来自Java的新意图的pushRoute不起作用
【发布时间】: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 函数。从那里我想要颤振打开流程页面。也许还有另一种方法可以完成这项工作?

【问题讨论】:

    标签: java flutter dart


    【解决方案1】:

    我通过使用 MethodChannel 实现了我的目标:platform channels

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 2023-03-15
      • 1970-01-01
      • 2012-06-02
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2017-11-12
      • 1970-01-01
      相关资源
      最近更新 更多