Check if device has camera in cross platform way

Viewed 897

I am writing a cross platform Xamarin.Forms Application where my app uses camera and requests camera permissions from the user at runtime. I am using Xamarin.Essentials nuget package to check and request permissions. But before I request camera access permission, I want to make sure the device has camera hardware. Is there any cross platform way to check whether the device has camera hardware? I checked the Xamarin.Essentials documentation and I don't seem to find it anywhere.

2 Answers

We should use Media Picker now, as support for Media plugin officially stopped in Dec 2020:

Xamarin.Essentials 1.6 introduced official support for picking/taking photos and videos with the new Media Picker API. [...] I will officially be archiving this library in December 2020 [...]

the Media plugin has this API

CrossMedia.Current.IsCameraAvailable
Related