JimmyPun610 / BarcodeScanner.Mobile

Barcode Scanner using GoogleVision API for Xamarin Form, Maui
MIT License
340 stars 100 forks source link

How to select front camera? #88

Closed energywave closed 2 years ago

energywave commented 3 years ago

AS the title I have the need to use the front camera to read qr codes. I've seen in the internal where you select the back camera if existant and only if the back camera is not there you select the front. I'm new to Xamarin and I'm struggling to understand how to be able to set this from code... Can you maybe implement this or tell me the way to follow?

stepkillah commented 3 years ago

it sounds like a good feature for this plugin

JimmyPun610 commented 2 years ago

please try version 6.1.1-pre

energywave commented 2 years ago

Thank you, great! I'll try it soon and let you know! Did you update dependencies to align with latest Xamarin.Forms? Otherways we'll have to update again the project dependencies in the project file (as that's impossible to do it using NuGet, don't understand why...)

JimmyPun610 commented 2 years ago

Thank you, great! I'll try it soon and let you know! Did you update dependencies to align with latest Xamarin.Forms? Otherways we'll have to update again the project dependencies in the project file (as that's impossible to do it using NuGet, don't understand why...)

The dependencies are updated as below

<ItemGroup>
        <!-- This None is here so the conditionally included files show up in the Solution Explorer -->
        <None Include="**\*.cs;**\*.xml;**\*.axml;**\*.png" Exclude="obj\**\*.*;bin\**\*.*;bin;obj" />

        <!-- We will compile anything ending in .shared.cs  You can change this -->
        <Compile Include="Shared\*.cs" />
        <PackageReference Include="Xamarin.Essentials" Version="1.7.0" />
        <PackageReference Include="Xamarin.Forms" Version="5.0.0.2125" />
    </ItemGroup>
    <ItemGroup Condition=" $(TargetFramework.StartsWith('netstandard')) ">
        <Compile Include="NetStandard\*.cs" />
    </ItemGroup>

    <ItemGroup Condition=" $(TargetFramework.StartsWith('MonoAndroid')) ">
        <Compile Include="Android\*.cs" />
        <Compile Include="Android\**\*.cs" />
        <PackageReference Include="Xamarin.AndroidX.MediaRouter" Version="1.2.5">
        </PackageReference>
        <PackageReference Include="Xamarin.AndroidX.Lifecycle.LiveData" Version="2.3.1.3">
        </PackageReference>
        <PackageReference Include="Xamarin.AndroidX.Browser" Version="1.3.0.6">
        </PackageReference>
        <PackageReference Include="Xamarin.Google.Android.Material" Version="1.4.0.2">
        </PackageReference>
        <PackageReference Include="Xamarin.AndroidX.Palette" Version="1.0.0.10">
        </PackageReference>
        <PackageReference Include="Xamarin.AndroidX.Core" Version="1.6.0.3">
        </PackageReference>
        <PackageReference Include="Xamarin.AndroidX.RecyclerView" Version="1.2.1.1">
        </PackageReference>
        <PackageReference Include="Xamarin.AndroidX.Camera.Camera2" Version="1.0.2">
        </PackageReference>
        <PackageReference Include="Xamarin.AndroidX.Camera.Lifecycle">
            <Version>1.0.2</Version>
        </PackageReference>
        <PackageReference Include="Xamarin.AndroidX.Camera.View">
            <Version>1.0.0.5-alpha20</Version>
        </PackageReference>
        <PackageReference Include="Xamarin.Google.Dagger">
            <Version>2.37.0</Version>
        </PackageReference>
        <PackageReference Include="Xamarin.Google.MLKit.BarcodeScanning">
            <Version>116.1.2.1</Version>
        </PackageReference>
    </ItemGroup>

    <ItemGroup Condition=" $(TargetFramework.StartsWith('Xamarin.iOS')) ">
        <Compile Include="iOS\*.cs" />
        <Compile Include="iOS\**\*.cs" />
        <PackageReference Include="System.Numerics.Vectors" Version="4.5.0">
        </PackageReference>
        <PackageReference Include="Xamarin.Firebase.iOS.Core" Version="6.10.4">
        </PackageReference>
        <PackageReference Include="Xamarin.Firebase.iOS.MLKit.Vision" Version="0.21.0">
        </PackageReference>
    </ItemGroup>