Quantcast
Channel: Xamarin.Forms — Xamarin Community Forums
Viewing all articles
Browse latest Browse all 91519

Downloading an Image and Sharing it to Facebook

$
0
0

Hi,

I am trying to download an external image to the phone from the internet then upload the image to Facebook on a button click in Xamarin. This is a sharing text solution I found online which works well.

Interface:
public interface IShareable
{
void OpenShareIntent(string textToShare);
}

IOS Side:
public void OpenShareIntent(string textToShare)
{
var activityController = new UIActivityViewController(new NSObject[] { UIActivity.FromObject(textToShare) }, null);
UIApplication.SharedApplication.KeyWindow.RootViewController.PresentViewController(activityController, true, null);
}

Android Side:
public void OpenShareIntent (string textToShare)
{
var myIntent = new Intent(Android.Content.Intent.ActionSend);
myIntent.SetType("text/plain");
myIntent.PutExtra(Intent.ExtraText, textToShare);
Forms.Context.StartActivity(Intent.CreateChooser(myIntent,"Choose an App"));
}

But what I want to do is give it a string with a website url to an image and it will download the image to the device then share it.

Any help would be great.

Thanks in advance.


Viewing all articles
Browse latest Browse all 91519

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>