如何排除从分享菜单中选择您自己的应用程序?自己的、应用程序、菜单中

2023-09-05 10:11:21 作者:仗着胸大说瞎话

该应用程序有一个意图过滤器,使其能够出现在经ACTION_SEND意图其它应用程序共享菜单。该应用程序本身也有使用ACTION_SEND和createChooser()A股菜单,和我的应用程序出现在列表中。因为他们已经在我的应用程序,我觉得奇怪,让他们能够分享到它自身。

有没有办法为我的应用程序不会出现在列表中,如果它正从我的应用程序叫什么名字?

解决方案   

有没有办法为我的应用程序不会出现在列表中,如果它正从我的应用程序叫什么名字?

而不是通过 createChooser()。您可以创建通过 PackageManager 你自己选择器般的对话和 queryIntentActivities()和筛选自己出这样一来,虽然。

The app has an intent filter to allow it to appear in the share menu in other applications via ACTION_SEND intents. The app itself also has a share menu using ACTION_SEND and createChooser(), and my app appears in the list. Since they are already in my app it seems strange to have them be able to share back to itself.

Is there a way for my app not to appear in the list if it's being called from my app?

解决方案 如何为 Mac 添加新语言

Is there a way for my app not to appear in the list if it's being called from my app?

Not via createChooser(). You can create your own chooser-like dialog via PackageManager and queryIntentActivities() and filter yourself out that way, though.