'Setting my app as a sharing target (Xamarin)

I'm looking for a way to enable my users to send images to my app via sharing (On android).

My main goal right now is to get my app on the "share to" tab when pressing the share button in the gallery, and storing the shared picture(or a link to the picture).



Solution 1:[1]

To have your project in share list you need to manipulate your menifest file

 <application
    android:allowBackup="true"
    android:icon="@mipmap/ic_launcher"
    android:label="@string/app_name" 
    android:roundIcon="@mipmap/ic_launcher_round"
    android:supportsRtl="true" 
    android:theme="@style/AppTheme">

<activity android:name=".MyActivity" >
    <intent-filter>
        <action android:name="android.intent.action.SEND" />
        <category android:name="android.intent.category.DEFAULT" />
        <data android:mimeType="image/*" />
    </intent-filter>
    <intent-filter>
        <action android:name="android.intent.action.SEND" />
        <category android:name="android.intent.category.DEFAULT" />
        <data android:mimeType="text/plain" />
    </intent-filter>
    <intent-filter>
        <action android:name="android.intent.action.SEND_MULTIPLE" />
        <category android:name="android.intent.category.DEFAULT" />
        <data android:mimeType="image/*" />
    </intent-filter>
</activity>

    </application>  

& for more information on this you can visit this & this

In those links you might get things in more precise way. Good luck.

Solution 2:[2]

I faced the same problem After some effort, I found this solution Remove this from the manifest file

<activity android:name=".MyActivity" >
   .....
</activity>

And replace it with this code in the activity you want to run directly

[IntentFilter(new[] { "android.intent.action.SEND" }, Categories = new[] { Intent.CategoryDefault }, DataMimeTypes = new[] { "text/plain" })]

my best wishes

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1
Solution 2 omar