Q:

Xamarin forms Unable to unable to to get file location

I have to open the camera and take a picture but I can't make it work. I searched similar posts but I can't figure it out. Any advice?
Manifest
<provider android:name="android.support.v4.content.FileProvider" 
              android:authorities="${applicationId}.fileprovider" 
              android:exported="false" 
              android:grantUriPermissions="true">

      <meta-data android:name="android.support.FILE_PROVIDER_PATHS" 
                 android:resource="@xml/file_paths"></meta-data>
    </provider>

file_paths
<external-files-path name="my_images" path="Pictures" />
<external-files-path name="my_movies" path="Movies" />
<external-path name="my_images" path="Android/data/com.plugin.mediatest/files/Pictures" />

Code
await CrossMedia.Current.Initialize();
            if (!CrossMedia.Current.IsTakePhotoSupported && !CrossMedia.Current.IsPickPhotoSupported)
            {
                await DisplayAlert("Message", "Unavailable", "OK");
                return;
            }
            else
            {
                var file = await CrossMedia.Current.TakePhotoAsync(new StoreCameraMediaOptions
                {
                    Directory = "Images",
                    Name = DateTime.Now +".jpg",
                    SaveToAlbum = false
                });
                await DisplayAlert("FilePath", file.Path, "OK");
                PhotoImage.Source = ImageSource.FromStream(() =>
                {
                    var stream = file.GetStream();
                    return stream;
                });

A:

You can refer to this Usage , and there is a sample on GitHub .
takePhoto.Clicked += async (sender, args) =>
{
    await CrossMedia.Current.Initialize();

    if (!CrossMedia.Current.IsCameraAvailable || !CrossMedia.Current.IsTakePhotoSupported)
    {
        DisplayAlert("No Camera", ":( No camera available.", "OK");
        return;
    }

    var file = await CrossMedia.Current.TakePhotoAsync(new Plugin.Media.Abstractions.StoreCameraMediaOptions
    {
        Directory = "Sample",
        Name = "test.jpg"
    });

    if (file == null)
        return;

    await DisplayAlert("File Location", file.Path, "OK");

    image.Source = ImageSource.FromStream(() =>
    {
        var stream = file.GetStream();
        return stream;
    }); 
};

About Android Misc Setup ,
By default, the library adds android.hardware.camera and android.hardware.camera.autofocus to your apps manifest as optional features. It is your responsbility to check whether your device supports the hardware before using it. If instead you'd like Google Play to filter out devices without the required hardware, add the following to your AssemblyInfo.cs file in your Android project:
[assembly: UsesFeature("android.hardware.camera", Required = true)]
[assembly: UsesFeature("android.hardware.camera.autofocus", Required = true)]

You must also add a few additional configuration files to adhere to the new strict mode:
1.) Add the following to your AndroidManifest.xml inside the  tags:
<provider android:name="android.support.v4.content.FileProvider" 
          android:authorities="${applicationId}.fileprovider" 
          android:exported="false" 
          android:grantUriPermissions="true">

      <meta-data android:name="android.support.FILE_PROVIDER_PATHS" 
                     android:resource="@xml/file_paths"></meta-data>
</provider>

2.) Add a new folder called xml into your Resources folder and add a new XML file called file_paths.xml. Make sure that this XML file has a Build Action of: AndroidResource.
Add the following code:
<?xml version="1.0" encoding="utf-8"?>
<paths xmlns:android="http://schemas.android.com/apk/res/android">
    <external-files-path name="my_images" path="Pictures" />
    <external-files-path name="my_movies" path="Movies" />
</paths>

Final effect :

==================================Update=====================================
After checking shared sample , there are two problems. 
First , you'd better update Nuget Package(Xamarin Forms 3.1) of Solution to the latest version (Xamarin Forms 4.3).

Second , you forgot to add Provider to AndroidManifest.xml :
<provider android:name="android.support.v4.content.FileProvider" android:authorities="com.companyname.fileprovider.fileprovider" android:exported="false" android:grantUriPermissions="true">
        <meta-data android:name="android.support.FILE_PROVIDER_PATHS" android:resource="@xml/files_paths"></meta-data>
 </provider>

Note: The part parameter(android:resource) inside of the provider need to be modified to your customed name(@xml/files_paths) in poject . You named it not @xml/file_paths , then it can not find provider .
Sample effect:

