如何打开 Native Android App 并将数据传递到 Flutter Android App?

How to open and pass data from Native Android App to Flutter Android App?

我想在 Flutter Android 应用程序中从原生 Android 应用程序打开并获取一些数据(用户 ID、令牌等)。

我知道使用 Intent 我可以使用包名称打开和传递数据,但是如何在 Flutter App 中检索?

如何实现?

我们可以通过下面的代码打开应用程序

//open app if app no background /killed
 val intent = context.packageManager.getLaunchIntentForPackage(context.packageName)
 intent!!.addFlags(Intent.FLAG_ACTIVITY_REORDER_TO_FRONT)
 context.startActivity(intent)

如果你想将数据从 Native 传递到 Flutter 那么你应该实现 MethodChannel/EventChannel

参考下面 link 原生到 Flutter 原生到 Flutter 通信