本文介绍了如何打开数据并将其从Native Android App传递到Flutter Android App?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我想从Native Android应用中打开并获取Flutter Android应用中的一些数据,例如(用户ID,令牌等).
I wants to open and get some data like (userid, token, etc.) in Flutter Android app from Native Android app.
我知道我可以使用Intent打开和传递带有程序包名称的数据,但是如何在Flutter App中进行检索?
I know that using Intent I can open and pass data with Package Name but how to retrieve in Flutter App?
如何使其成为可能?
推荐答案
我们可以通过以下代码打开应用
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)
如果要将数据从本机传递到Flutter,则应实现 MethodChannel
/ EventChannel
If you want to pass data from Native to Flutter then you should be implement MethodChannel
/EventChannel
请参阅下面的Flutter原生链接原生到Flutter沟通
Refer below link for Native to Flutter Native to Flutter communication
这篇关于如何打开数据并将其从Native Android App传递到Flutter Android App?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!