Forum Xamarin.Android

Receive images from other apps

RiccardoBadiniRiccardoBadini ITMember ✭✭
edited May 2016 in Xamarin.Android

Hi guys, I've build a Xamarin Android App and I want to share images into it from other apps.
To do this I've read some articles on web and I've found some suggestions to implement it.

I modified the Manifest file as follow:

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

Then into the ChildActivity.cs code I've to manage data sent from other apps.

The problem is that I can't see my app into the "chooser list" from other apps.
For example if I open an image from my Gallery and I click on the share button, the apps list appear but my app is not into this list.

Which is the problem?

Please help...thanks :)

Posts

  • ZARkZARk BEMember ✭✭

    I have the same issue as you.
    Found this : http://slackshotindustries.blogspot.be/2013/07/using-intents-in-xamarin-to-catch-send.html

    But it doesn't work for me :(

  • kenneth.leekenneth.lee USMember ✭✭✭

    @RiccardoBadini @ClaudedHave Did you guys end up finding a solution for this?

  • TirumalTirumal USMember ✭✭

    In xamarin use the IntentFilter attribute on startup activity, you will found you app in shared list.

    [IntentFilter(new[] { Intent.ActionView }, Categories = new[] { Intent.CategoryDefault},DataMimeTypes = new[] { "text/plain", "/" }, )]
    public class StartActivity :Activity
    {
    Intent intent = Intent;
    var shareAction = intent.Action;
    var type = intent.Type;

    if (Intent.ActionSend.Equals(shareAction))
    {
        if (type.Contains("text/plain"))
        {
            // write your logic here........
                }
        else
        {
            Android.Net.Uri imageUri = (Android.Net.Uri)Intent.GetParcelableExtra(Intent.ExtraStream);
            // here you will get the image or video or any file path
            // write your logic here........
        }
    }
    

    }

  • John_John_ USMember ✭✭
    edited March 2017

    --

Sign In or Register to comment.