How to Exclude my App from a list of Sharing Targets when my app is the data source?

dg2k 1,396 Reputation points
2023-11-17T10:49:03.9633333+00:00

My App is a Sharing Target to accept simple text data such as web addresses from external apps such as YouTube, Facebook, etc. For this, my app appears in the list of target apps when a user invokes a Share command from an external app. If my app is chosen (as a sharing target), the web address being shared will be received from the external app. Here, my Android app uses Intent Filter to get to data being shared. No problem here.

My app also shares its data with external apps, and this time as a data Source rather than Target. For this the Share.RequestAsync() method under Microsoft.Maui.ApplicationModel.DataTransfernamespace is used.

The minor issue I'm having now is that my app will also appear in the list of targets when it's a data source and I do not want this to happen. I prefer for my app to be EXCLUDED from the list of targets when my app is a data source. This can be also confusing to the user hence why better excluded.

How can I avoid my app from a list of Sharing Targets when it is a sharing data source, that is, when using the Share.RequestAsync() API?

.NET MAUI
.NET MAUI
A Microsoft open-source framework for building native device applications spanning mobile, tablet, and desktop.
3,411 questions
0 comments No comments
{count} votes

Accepted answer
  1. Leon Lu (Shanghai Wicresoft Co,.Ltd.) 74,491 Reputation points Microsoft Vendor
    2023-11-20T07:19:57.3133333+00:00

    Hello,

    How can I avoid my app from a list of Sharing Targets when it is a sharing data source, that is, when using the Share.RequestAsync() API?

    No, there are no methods or properties to exclude your application in the Share.RequestAsync() API, you can check the doc about Share.RequestAsync Method.

    And it will show the operating system's user interface to share content, we cannot custom operating system's interface.

    Best Regards,

    Leon Lu


    If the answer is the right solution, please click "Accept Answer" and kindly upvote it. If you have extra questions about this answer, please click "Comment".

    Note: Please follow the steps in our documentation to enable e-mail notifications if you want to receive the related email notification for this thread.

    0 comments No comments

0 additional answers

Sort by: Most helpful

Your answer

Answers can be marked as Accepted Answers by the question author, which helps users to know the answer solved the author's problem.