question

JassimAlRahma-9056 avatar image
0 Votes"
JassimAlRahma-9056 asked JassimAlRahma-9056 commented

Scan QR code using Xamarin Forms

Hi,

How can I scan QR code in Xamarin Forms using the Native iOS and Android and without having to use a thirdparty tool?


Thanks,
Jassim

dotnet-xamarin
5 |1600 characters needed characters left characters exceeded

Up to 10 attachments (including images) can be used with a maximum of 3.0 MiB each and 30.0 MiB total.

1 Answer

AmyPeng1-MSFT avatar image
0 Votes"
AmyPeng1-MSFT answered JassimAlRahma-9056 commented

Hello,

If you want to scan QR code in Xamarin Forms using the Native API, you can do it by using this way:

  1. First we need to find a Xamarin Wrapper to use native APIs on Android and iOS:
    iOS: you can use this CIDetector.CreateQRDetector to recognizes QR codes.

    Android: Based on this google doc we can use ML Kit to recognize and decode barcodes in Android Application. In Xamarin ML Kit is wrapped in the Xamarin GooglePlay Services: Xamarin.Google.MLKit.BarcodeScanning.

    UWP: You can use this BarcodeScanner API directly.

2. Then you can use DependencyService to enable Xamarin.Forms applications to invoke native platform API.
For how to use DependencyService, please check:
https://docs.microsoft.com/en-us/xamarin/xamarin-forms/app-fundamentals/dependency-service/introduction.

Thanks,
Amy Peng






· 1
5 |1600 characters needed characters left characters exceeded

Up to 10 attachments (including images) can be used with a maximum of 3.0 MiB each and 30.0 MiB total.

I hope Microsoft MAUI will have it as part of the MAUI instead of using a platform specific.

0 Votes 0 ·