Giter Site home page Giter Site logo

shibu-narayanan / smartscanner-core Goto Github PK

View Code? Open in Web Editor NEW

This project forked from newlogic/smartscanner-core

1.0 0.0 1.0 246.05 MB

ID scanning Android app and library. Supports MRZ, NFC, Barcodes, and ID PASS Lite cards.

License: Apache License 2.0

Java 4.57% Kotlin 95.43%

smartscanner-core's Introduction

SmartScanner Core

ID scanning Android app and library. Supports MRZ, NFC, Barcodes, and ID PASS Lite cards.

Note: The library's API might keep evolving before we reach v1.0, so be careful when upgrading between these pre-v1.0 versions. Starting at v1.0 we will be careful in introducing breaking API changes.

Features

  • Scan MRZ
  • Scan NFC
  • Scan Barcode
  • Scan ID PASS Lite
  • Supports Intent Call Out (ODK & Non-ODK)

This repository also includes an Android demo app to test what the library can do.

Related projects

Installation

Declare Maven Central repository in the dependency configuration, then add this library in the dependencies. An example using build.gradle:

repositories {
  mavenCentral()
}

dependencies {
  implementation "org.idpass:idpass-smartscanner:0.0.1-SNAPSHOT"
}

If you want to build this library from source, instructions to do so can be found in the Building from source wiki page.

Usage

The following table shows the intent actions available for each operation available in the library, both in ODK and Non-ODK:

Scan Operation ODK Non-ODK
MRZ org.idpass.smartscanner.odk.MRZ_SCAN org.idpass.smartscanner.MRZ_SCAN
NFC org.idpass.smartscanner.odk.NFC_SCAN org.idpass.smartscanner.NFC_SCAN
Barcode org.idpass.smartscanner.odk.BARCODE_SCAN org.idpass.smartscanner.BARCODE_SCAN
QR code org.idpass.smartscanner.odk.QRCODE_SCAN org.idpass.smartscanner.QRCODE_SCAN
ID PASS Lite org.idpass.smartscanner.odk.IDPASS_LITE_SCAN org.idpass.smartscanner.IDPASS_LITE_SCAN

To perform an operation, create an intent for the desired operation. This example shows how to call an intent to scan an MRZ (ODK):

import android.app.Activity
import android.content.ActivityNotFoundException
import android.content.Intent
import androidx.appcompat.app.AppCompatActivity

class MainActivity : AppCompatActivity() {

  private const val OP_SCANNER = 1001 // Activity request code

  override fun onStart() {
    super.onStart()

    try {
      val action = "org.idpass.smartscanner.odk.MRZ_SCAN"
      val intent = Intent(action)
      startActivityForResult(intent, OP_SCANNER)
    } catch (ex: ActivityNotFoundException) {
      ex.printStackTrace()
    }
  }

  public override fun onActivityResult(requestCode: Int, resultCode: Int, intent: Intent?) {
    super.onActivityResult(requestCode, resultCode, intent)

    if (requestCode == OP_SCANNER) {
      if (resultCode == Activity.RESULT_OK) {
        val bundle = intent?.getBundleExtra("result")
      }
    }
  }

}

The bundle variable is a Bundle object containing the scan results. For example, the scanned surname can be obtained through:

val surname = bundle.getString("surname")

Refer to the Result fields reference for the different fields available from the scan results.

Refer to the API Reference for complete information about each scan operation and the different options available.

Finally, for convenience we recommend using the smartscanner-android-api library which simplifies the app intent call out process.

Running the demo app

The Android demo app is available in this repository's app directory. Open this directory in Android Studio (version 4.1 and above) and the app can be built and run from there.

License

Apache-2.0 License

smartscanner-core's People

Contributors

rjmangubat23 avatar jeremi avatar arnellebalane avatar anish-rajan avatar shibu-narayanan avatar nabaanahith avatar typelogic avatar

Stargazers

 avatar

Forkers

anish-rajan

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.