0

i am using CrossShareFile.Current.ShareRemoteFile to share file. Its working fine in IOS but not in android. When i click on share button its giving me this error Plugin.ShareFile: ShareLocalFile Exception: Android.OS.FileUriExposedException: file:///storage/emulated/0/test.pdf exposed beyond app through ClipData.Item.getUri()

i have tried many things, but couldnt succeed on this

async void Handle_Clicked(object sender, System.EventArgs e)
        {
          await    CrossShareFile.Current.ShareRemoteFile("http://onlinekih.somee.com/Documents/8.pdf","test.pdf");

        }
waqas waqas
  • 197
  • 9
  • 22
  • 1
    Sounds like you need to set up a [FileProvider](https://stackoverflow.com/questions/48415727/xamarin-forms-file-provider-not-set) – Nick Peppers May 12 '19 at 17:17

1 Answers1

0

Hi Use Xamarin Essentials: using Xamarin.Essentials; public class ShareTest { public async Task ShareText(string text) { await Share.RequestAsync(new ShareTextRequest { Text = text, Title = "Share Text" }); }

public async Task ShareUri(string uri)
{
    await Share.RequestAsync(new ShareTextRequest
        {
            Uri = uri,
            Title = "Share Web Link"
        });
}

}strong text