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

Xamarin.Plugin.FilePicker Not working on android 9

$
0
0

Hi,

I have been trying to implement cross platform xamarin forms file picker and i'm experiencing pdf, docx or doc file picker issues. i used the code below and noticed that it only works when i pick images and doesnt work on document. i tried it on android 5.1 and also on android 9.0

  • Android 5.1 works for both images and document.
  • Android 9.0 only picks images.

    try
    {
    FileData fileData = await CrossFilePicker.Current.PickFile();
    if (fileData == null)
    return; // user canceled file picking

            string fileName = fileData.FileName;
            string contents = System.Text.Encoding.UTF8.GetString(fileData.DataArray);
    
            System.Console.WriteLine("File name chosen: " + fileName);
            System.Console.WriteLine("File data: " + contents);
        }
        catch (Exception ex)
        {
            System.Console.WriteLine("Exception choosing file: " + ex.ToString());
        }
    

Viewing all articles
Browse latest Browse all 77050

Trending Articles



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