简体   繁体   中英

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

I wants to open and get some data like (userid, token, etc.) in Flutter Android app from Native Android app.

I know that using Intent I can open and pass data with Package Name but how to retrieve in Flutter App?

How to make it possible?

从 Native App 打开 Flutter 应用

We can open app by below code

//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)

If you want to pass data from Native to Flutter then you should be implement MethodChannel / EventChannel

Refer below link for Native to Flutter Native to Flutter communication

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM