plus_plugins icon indicating copy to clipboard operation
plus_plugins copied to clipboard

[Question]: Is it possible to share content(image, video, document, etc) through specific platform only in flutter?

Open manoj-simform opened this issue 2 years ago • 7 comments

I want to share content(image, audio, video, or document) to other platforms using share_pluse package.

This package provides options for all platforms which are feasible to share the content(image, audio, video, or document). But in my case, I want to show only fix the specific platforms to users on which they can share the content.

For Ex, I have one photo and i want to send it to another app. in share option it shows 5 app in which i can share that photo but i want allowed user to share 3 of them.

So Is there any way using which we can fix this problem?

manoj-simform avatar Jun 22 '22 13:06 manoj-simform

Hello @miquelbeltran Do we have any update this or are we planning to take care of this feasibility in our next coming release?

Hi there, if I understand you correctly you want to restrict the apps that the user can select to share your content with. For iOS _shouldExcludeActivityType (private not guaranteed API) looks promising (blacklist & whitelist) and for Android it seems that we can only control what we exclude (only blacklist).

But it is probably not advisable fo limit the user in such a way. The Android documentation states:

You can exclude specific targets by providing Intent.EXTRA_EXCLUDE_COMPONENTS. This is to be used only to remove targets you have control over.

Coronon avatar Jul 06 '22 08:07 Coronon

@Coronon Thank you for the reply.

Yes, We want to share our content with pre-specified apps only. Excluding apps will not work because we will be bot always aware that which are newly installed apps on the phone. So, we only want to share our content with whitelist apps.

In, _shouldExcludeActivityType it will exclude specified apps. While we want the exact opposite of that we just want to include specified apps.

For Ex, I have one video and it will be shared only on WhatsApp and Facebook. So I will add WhatsApp and Facebook to my whitelisted apps. Afterwards, it will only allow data to be shared with Facebook and WhatsApp and it will exclude all others.

manoj-simform avatar Jul 11 '22 13:07 manoj-simform

@manojSimfrom Thanks for your clarification.

We can use _shouldExcludeActivityType because it is a function that has to return a bool whether the specific action should be excluded. By only returning true for whitelisted apps this can implement both a black- and whitelist.

What do you mean by Ex? I am not aware of an option like that for Android.

Coronon avatar Jul 11 '22 15:07 Coronon

@Coronon Thanks for the quick reply.

Ex stands for example, where I was trying to explain my requirement. Does the share_plush plugin provide the feasibility to exclude the apps as you mentioned to use _shouldExcludeActivityType the flag?

manoj-simform avatar Jul 12 '22 09:07 manoj-simform

I would have to test that. I read somewhere that that API is not included in the newest iOS versions but would have to check.

The reality is that Android does not support this and we should probably not segregate the feature set further - what do you think @miquelbeltran ?

Coronon avatar Jul 12 '22 11:07 Coronon

Our rule of thumb is that if a feature is only supported on a single platform, it shouldn't be included, but we can do exceptions, of course. In this case, I am not sure if I would.

miquelbeltran avatar Jul 13 '22 07:07 miquelbeltran

This issue is stale because it has been open 60 days with no activity. Remove stale label or comment or this will be closed in 15 days

github-actions[bot] avatar Dec 28 '22 00:12 github-actions[bot]