Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up

ID scanning SDK, wrapped for cross-platform apps built with Xamarin.

NotificationsYou must be signed in to change notification settings

BlinkID/blinkid-xamarin

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Enhance your Xamarin cross-platform apps with an AI-driven mobile ID scanning software.

Please note that, for maximum performance and full access to all features, it’s best to go with one of our native SDKs (foriOS orAndroid).

Below you can try out our sample app, read the integration guides for both Android and iOS and study advanced topics ⬇️

Integration into Xamarin Forms project

Steps for integrating BlinkID into your Xamarin Forms project:

  1. In both yourCore,Droid andiOS projects, addBlinkID.Forms NuGet package as a reference.
  2. In yourDroid project, update yourMainActivity.cs in a following way:
    • update yourMainActivity class so that it implementsBlinkID.Forms.Droid.IMicroblinkScannerAndroidHostActivity. This interface specifies 2 properties and 1 method that you must implement:
      • HostActivity property must return reference to current host activity.
      • ScanActivityRequestCode property must return integer that will be used as request code for Android'sStartActivityForResult invocation
      • ScanningStarted method will be called just before scanning starts. It will receive currently usedMicroblinkScannerImplementation as a parameter. You should save a reference to this object because you will need it later in your implementation ofOnActivityResult
    • overrideActivity's methodOnActivityResult and pass its parameters to reference ofMicroblinkScannerImplementation
  3. YouriOS project does not need any modifications.
  4. In yourCore project, obtain a reference toIMicroblinkScannerFactory using aDependencyService
  5. Use a factory to create an instance ofIMicroblinkScanner.
  6. Use the dependency service to create recognizer you wish to use
  7. Subscribe toMessages.ScanningDoneMessage that will inform you whether the scanning has completed or was cancelled by end user
  8. Using on or more of recognizer objects obtained in step 6., create an instanceIRecognizerCollection usingIRecognizerCollectionFactory obtained viaDependencyService
  9. Create a settings object for desired UI overlay
  10. Start scanning by invoking methodScan on instance ofIMicroblinkScanner

Xamarin Forms sample app

Xamarin Forms sample app is availablehere.

Integration into native Android project

In your native Android project, add reference toBlinkID.Android.Binding NuGet package and follow the integration instructions forBlinkID Android SDK.

Native Android sample app

Native Android sample app is availablehere.

Integration into native iOS project

In your native iOS project, add reference toBlinkID.iOS.Binding NuGet package and follow the integration instructions forBlinkID iOS SDK.

Native iOS sample app

Native iOS sample app is availablehere.

Integration via Binding projects

If you do not wish to use BlinkID NuGet packages, you can directly reference binding projects in your solutions. Just make sure that following conditions are met:

  • all large binary files have been checked out
    • to ensure that all files have been checked out, please make sure that you have installedGit Large File Storage and that you have fetched all LFS files withgit lfs pull command.
  • your solution has referenced all dependencies of the project that you are referencing

Directory and files summary

Advanced topics

Updating native binding libraries

Android

  1. Download latest AAR fromAndroid SDK repository
  2. ReplaceBinding/Android/Jars/LibBlindID.aar with latest AAR
  3. OpenBinding/Forms/BlinkID.Forms/BlinkID.Forms.sln solution
  4. If needed, updateTransforms/Metadata.xml inAndroidBinding project.
  5. Right-click theAndroidBinding project, selectOptions, underNuGet Package section selectMetadata
  6. UpdateVersion on tabGeneral
  7. UpdateRelease notes on tabDetails
  8. Rebuild theAndroidBinding project

iOS

  1. Download latestMicroBlink.bundle andMicroBlink.framework fromiOS SDK repository

  2. ReplaceBinding/iOS/MicroBlink.bundle andBinding/iOS/MicroBlink.framework with latest versions

  3. Generate newApiDefinitions.cs andStructsAndEnums.cs with latest version ofObjective Sharpie, butDO NOT OVERWRITE existingApiDefiniton.cs andStructs.cs

    • you can generate newApiDefinitions.cs andStructsAndEnums.cs with following command (replaceiphoneos11.4 with latest SDK you have on your Mac):
    cd Binding/iOSsharpie bind -sdk iphoneos11.4 MicroBlink.framework/Headers/MicroBlink.h -scope MicroBlink.framework/Headers -namespace Microblink -c -F .
  4. Manually merge new structures from generatedStructsAndEnums.cs into existingStructs.cs while fixing compile errors

    • sharpie generates enums with underlying types such asnuint ornint which are not supported by latest version of C# - you must replace those withuint orint types.
  5. Manually merge new API classes from generatedApiDefinitions.cs into existingApiDefinition.cs

    • note that diff between those two files may be quite large, asApiDefinition.cs has been manually edited to ensure correct compilation and correct exposure of all native SDK features. Focus only on adding new recognizers and parsers. Usually it shuold not be necessary to add other classes.
  6. OpenBinding/Forms/BlinkID.Forms/BlinkID.Forms.sln solution

  7. FromiOSBinding project removeMicroBlink.bundle and re-add it back

    • this will ensure that all new resources from new bundle are correctly added to the project
    • also make sure that all resources within addedMicroBlink.bundle haveBuildAction set toBundleResource
  8. Right-click theiOSBinding project, selectOptions, underNuGet Package section selectMetadata

  9. UpdateVersion on tabGeneral

  10. UpdateRelease notes on tabDetails

  11. Rebuild theiOSBinding project and fix any compile errors that may have been introduced in steps 4. and 5.

Updating Xamarin Forms core and platform implementations

  1. Ensure thatboth Android and iOS native binding libraries have been updated as explained above
  2. OpenBinding/Forms/BlinkID.Forms/BlinkID.Forms.sln solution
  3. Right-click theBlinkID.Forms.Core project, selectOptions, underNuGet Package section selectMetadata
  4. UpdateVersion on tabGeneral
  5. UpdateRelease notes on tabDetails
  6. Do the same forBlinkID.Forms.Android,BlinkID.Forms.iOS andBlinkID.Forms.NuGet projects
  7. inBlinkID.Forms.Core add interfaces for new functionality (e.g. new recognizer)
  8. add implementation for those interfaces inBlinkID.Forms.Android andBlinkID.Forms.iOS projects
  9. rebuild bothBlinkID.Forms.Core,BlinkID.Forms.Android andBlinkID.Forms.iOS projects

Creating updated NuGet packages

  1. Ensure that all projects have been updated as described above
    • this includes Android and iOS native binding librariesand Xamarin Forms core and platform implementations libraries
  2. OpenBinding/Forms/BlinkID.Forms/BlinkID.Forms.sln solution
  3. Make sureRelease build type is selected inVisual Studio
  4. Right-click onBlinkID.Forms.NuGet project and selectCreate NuGet package
    • all projects will be built and their respective NuGet packages will be created in theirbin/Release folder
  5. Upload packages toNuGet

Android custom integration

This section describes how to create your scan activity with BlinkID SDK, natively in Android and wrap it to Xamarin. For that purpose, we have preparedAndroidCustomUI sample.

Steps to wrap custom functionality to Xamarin:

  1. Implement it natively for Android - create Android library:
    • make sure that you are not using any resources from the BlinkID Android SDK in resource files inside your library, otherwise, you will get compile errors while generating Xamarin bindings from Android library
    • we have createdBlinkIDWrapper Android Studio project which containsLibBlinkIDWrapper Android library module with custom scan activity
  2. Build .aar archive from the library module:
    • we have builtLibBlinkIDWrapper-release.aar from our Android library module
  3. Create a new Xamarin Bindings Library for Android:
    • add a dependency toBlinkID.Android.Binding nuget package
    • add.aar toJars folder and set theBuild Action for.aar toLibraryProjectZip
    • we have preparedCustomUIBinding project insideCustomUISample solution
  4. You can use the Bindings Library in the application project:
    • first, add a reference to the created Bindings Library
    • add a dependency toBlinkID.Android.Binding
    • we have prepared sample application projectCustomUIApp insideCustomUISample solution

[8]ページ先頭

©2009-2025 Movatter.jp