Xamarin Steps Project
This project is a demo Android app to show how to integrate our decoding library in an Xamarin Project. To make it work, just follow the few steps below.
- Open this demo project
- Download the decoding library from http://scan.smartidlab.com or use the one provided by Icare.
- Put the decoding library files you received under
libs
in your root project (not the solution)
If you are using Visual Studio import directly the folder with the option "Add existing Folder...".
libs/arm64-v8a/libicaredecoders.so
libs/armeabi-v7a/libicaredecoders.so
libs/x86/libicaredecorders.so
libs/x86-64/libicaredecorders.so
To import correctly the Native Libraries you have 2 possibilieties.
In your explorer select each libicaredecoders.so and display the properties (Right click -> Properties). Then under "Build Action" choose "AndroidNativeLibrary".
OR
Open with a text editor the project file (demo_app.csproj) and ensure that the libraries imported have the rights informations
<ItemGroup>
<AndroidNativeLibrary Include="libs\arm64-v8a\libicaredecoders.so" />
<AndroidNativeLibrary Include="libs\armeabi-v7a\libicaredecoders.so" />
<AndroidNativeLibrary Include="libs\x86\libicaredecoders.so" />
<AndroidNativeLibrary Include="libs\x86_64\libicaredecoders.so" />
</ItemGroup>
If instead AndroidNativeLibrary you have None remove the lines with *.so information and put the lines above in a new ItemGroup block. Maybe you need clean your projet and rebuild it to correctly integrate the libraries.
For more information about Native Libraries in Xamarin
- Then put SmartScan_BL.dll into the folder
/dll
into your root project
Edit the "Refecences" of your project to add the SmartScan_BL.dll
.
- In the Solutions Explorer, right-click on References.
- Click Edit References….
- Click on the .NET Assembly tab.
- Navigate to the directory
dll
and select theSmartScan_BL.dll
.
- Set the decoding type according to the decoding library you downloaded, into the MainActivityFragment (see below in Implementation) :
mSmartScanner.SetDecodingType(IcareDecoders.CodeOcrb, IcareDecoders.CodeBvr);
Be careful because from the new version of Smart ID Scan you must enter a type and a subtype to start using the scanner.