简体   繁体   English

在同一移动设备中的两个 Flutter 应用程序之间共享数据

[英]Share data between two flutter apps in same mobile

I want to share data between two flutter apps without share package that share data between apps when user select installed application, I want to send data to one app and fetch that data from the second application.我想在没有共享包的两个颤振应用程序之间共享数据,当用户选择已安装的应用程序时在应用程序之间共享数据,我想将数据发送到一个应用程序并从第二个应用程序获取该数据。 How can I achieve this in flutter?我怎样才能在颤振中实现这一目标?

I achieved required functionality by using Content Providers of android and call them natively in flutter using method channels.我通过使用 android 的Content Providers实现了所需的功能,并使用方法通道在 Flutter 中本地调用它们。 Now its working fine as I want to achieve.现在它工作正常,正如我想要实现的那样。

you can learn more about Content Providers by visiting this link.您可以通过访问链接了解有关内容提供者的更多信息。

Note: I only want to achieve this for android not iOS.注意:我只想为 android 而不是 iOS 实现这一点。

If the apps are on the same device, then I would recommend an Sqlite databse.如果应用程序在同一设备上,那么我会推荐一个 Sqlite 数据库。

If you do not want to do that, the use an HTTPS API.如果您不想这样做,请使用 HTTPS API。

  • you can use a server to store the data and allow the aps to read & write it您可以使用服务器来存储数据并允许应用程序读取和写入它
  • or, you can simply have the apps sent HTTPS requests to each other on localhost at a port of your choice, BUT , that only works it the apps are on the same deveice.或者,您可以简单地让应用程序在您选择的端口上的localhost上相互发送 HTTPS 请求,只有应用程序位于同一设备上时才有效。 If they are on separate deveices then you must have a server如果他们在不同的设备上,那么你必须有一个服务器

I cannot see any other option.我看不到任何其他选择。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

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