softlion / ZXing.Net.Mobile

Barcode Scanner for Xamarin.iOS, Xamarin.Android, UWP and Tizen

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

ZXing.Net.Mobile

Build Status

Notes

This fork improves the stability and won't crash your app.
The package are published on this github's nuget package server. See usage below.

About

This .NET (C#) library make scanning barcodes as effortless and painless as possible.
It supports Xamarin iOS, Android, UWP, Mac (rendering only, not scanning), Tizen.

ZXing.Net.Mobile Logo

Usage (Xamarin Forms)

  1. Add this github nuget server to your nuget sources:
#Add the source locally
dotnet nuget add source --username yourGithubUsername --password oneOfYoursGithubPersonalAccessToken --store-password-in-clear-text --name github-softlion "https://nuget.pkg.github.com/softlion/index.json"

#Or add it to you project's root directory in a nuget.config file
#Make sure your Personal Access Token has only read rights on public packages, so you can check it in git 
dotnet nuget add source --configfile nuget.config --username yourGithubUsername --password oneOfYoursGithubPersonalAccessToken --store-password-in-clear-text --name github-softlion "https://nuget.pkg.github.com/softlion/index.json"

In your nuget list, you will now get an updated preview version of ZXing.Net.Mobile.Forms.

  1. Add or update the preview nuget ZXing.Net.Mobile.Forms

  2. Make sure Xamarin.Essentials is setup and initialized, including OnRequestPermissionsResult on Android.

  3. Add this initialization code just after Xamarin.Essentials:

//Android
ZXing.Net.Mobile.Forms.Android.Platform.Init();

//iOS
ZXing.Net.Mobile.Forms.iOS.Platform.Init();

//MacOS
ZXing.Net.Mobile.Forms.MacOS.Platform.Init();

//UWP
ZXing.Net.Mobile.Forms.WindowsUniversal.Platform.Init();

Android: the Camera permission is included for you.
If you would like to use the Flashlight API, add the Flashlight permission:

[assembly: UsesPermission(Android.Manifest.Permission.Flashlight)]

UWP: if finishing scanning or pressing the back button is causing the page to jump back further than expected, or if the UI of a page won't update after scanning, add NavigationCacheMode="Enabled" on the Page tag.

Misc

Barcode Formats

By default, all barcode formats are monitored while scanning. You can change which formats to check for by passing a ZxingScanningOptions instance into the StartScanning method:

Samples

There is a sample for each platform including examples of how to use custom overlays.

Thanks and License

See https://github.com/Redth/ZXing.Net.Mobile

Based on the open source Barcode Library: ZXing (Zebra Crossing), using the ZXing.Net Port.

About

Barcode Scanner for Xamarin.iOS, Xamarin.Android, UWP and Tizen

License:MIT License


Languages

Language:C# 100.0%