It's very common to work with the camera in applications: you want to take a photo or video, post on social media, or just keep it as records, from expenses to business cards.
For this recipe, we will use a Xamarin plugin to simplify the process and achieve the goal of using the camera for capturing photos and videos with a couple of code lines.
Create a Blank App (Xamarin.Forms Portable) solution from File | New | Project…, named
XamFormsTakingPhotos
and click OK.For each project created, we will add the
Xam.Plugin.Media
NuGet package. Right-click the projects one by one, choose Manage NuGet Packages and search and install theXam.Plugin.Media
package.Three permissions are required in the Android Manifest. These are added automatically when installing the NuGet package, but just check to make sure. Right-click on the Android package and choose Properties, select the Android Manifest tab and check for the following permission:
WRITE_EXTERNAL_STORAGE
...