如何使用android:launchMode =“ singleInstance”处理Flutter中来自外部应用程序的传入意图

问题描述 投票:3回答:2

在Flutter文档here如何处理Flutter中来自外部应用程序的传入意图清单显示android:launchMode="singleTop",并使用状态变量中的void initState()方法在颤动getSharedText();中传输共享文本。

无论如何,每次我向应用程序共享文本时,都会创建该应用程序的新实例。因此,我将清单更改为清单,更改为android:launchMode="singleInstance"(或单个任务)。

在这种情况下,void initiate()仅被调用一次,不能再用于调用getSharedText();。我尝试使用AppLifecycleState.resumed在那里调用getSharedText();,但数据始终为空。我希望flutter会为此提供示例项目。我找不到他们。有任何提示吗?

android-manifest flutter
2个回答
1
投票

此问题的答案可能是uni_links package


0
投票

我通过此插件android:launchMode="singleInstance"设法在receive_sharing_intent(或singleTask)中获得了意图。

© www.soinside.com 2019 - 2024. All rights reserved.