GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — GitHub - tarkalabs/EagleScan: Android barcode and QR scanning library

BranchesTags
Open more actions menu

Latest commit

 

History

34 Commits
34 Commits

Folders and files

NameName
Last commit message
Last commit date
example
example
 
 
gradle/wrapper
gradle/wrapper
 
 
scanner
scanner
 
 
.gitignore
.gitignore
 
 
CODE_OF_CONDUCT.md
CODE_OF_CONDUCT.md
 
 
LICENSE
LICENSE
 
 
README.md
README.md
 
 
build.gradle
build.gradle
 
 
gradle.properties
gradle.properties
 
 
gradlew
gradlew
 
 
gradlew.bat
gradlew.bat
 
 
settings.gradle
settings.gradle
 
 

Repository files navigation

Logo

EagleScan

EagleScan is Barcode scanning library that was born from our internal needs. It uses Firebase ML Kit internally to read barcode/QR codes. For list of supported formats look here.

Note: It bundles Firebase's Bundled ML Kit library that statically links ML model to the app at build time. Because of this, your app's size may grow by 2.4 MB. Supporting unbundled capability is not the priority right now. You may want to use Google's code-scanner If you want to go unbundled.

Screenshot

Recording.mp4

Instructions

Installation:

implementation('com.tarkalabs:eagle-scan:1.0.0')

Code Sample:

Library provides two way of integrations.

  1. BarcodeScannerActivity: This is the simplest way to integrate, Just register for activity result and launch the scanner Activity
  2. BarcodeScannerFragment: Use this fragment when using BarcodeScannerActivity is not possible due to any UI design constraints.

Using BarcodeScannerActivity:

val scanResultReceiver = registerForActivityResult(ScanBarcodeContract()) { result->
  handleBarcodeResult(result)
}

override fun onCreate(savedInstanceState: Bundle?) {
  super.onCreate(savedInstanceState)
  setContentView(R.layout.activity_main)
  findViewById<Button>(R.id.btn_scan_activity).setOnClickListener {
    scanResultReceiver.launch(null)
  }
}

Using BarcodeScannerFragment:

class MainActivity : AppCompatActivity(), ScanResultListener {
  
  override fun onCreate(savedInstanceState: Bundle?) {
    super.onCreate(savedInstanceState)
    setContentView(R.layout.activity_main)
  
    supportFragmentManager.commit {
      add(R.id.scanner_fragment_container, BarcodeScannerFragment.newInstance())
    }
  }
  
  override fun onScanResult(result: BarcodeResult) {
    handleBarcodeResult(result)
  }

BarcodeResult is a sealed class that represents Barcode scanning result. example:

fun handleBarcodeResult(result: BarcodeResult) {  
  when (result) {  
    is Error -> {
      // Error occured while scanning.
      result.exception.printStackTrace()
    }
    is Success -> {
      //Bacode scanned successfully.
      val barcode: BarcodeData = result.data
    }
    MissingPermission -> {
      // Camera scanning permission not availble.
      // Library asks for Camera permission, but if user denys it, It sends this Result.
    }
    UserCanceled -> {
      // Only BarcodeScannerActivity sends this result.
      // User cancelled barcode scanning by pressing back button in Barcode Scanner screen.
    }
  }  
}

BarcodeResult.Success exposes BarcodeData that contains actual barcode data. List of exposed Barcode types:

  • Plain
  • Isbn
  • WiFi
  • Url
  • Sms
  • GeoPoint
  • ContactInfo
  • Email
  • DriverLicense
  • CalendarEvent

Configuration: BarcodeScannerConfig lets to specify barcode format to be enabled and also lets you control visibility of flash button.

val scannerConfig = BarcodeScannerConfig.Builder()
  .barcodeFormats(Barcode.FORMAT_ALL_FORMATS)
  .showFlashButton(true)
  .build()

Check out the example inside this repo for complete integration steps.

About

Android barcode and QR scanning library

Topics

androidbarcode-scannercameraxmlkit-android

Resources

Readme
MIT license

Code of conduct

Code of conduct
Activity
Custom properties

Stars

4 stars

Watchers

9 watching

Forks

1 fork
Report repository

Releases

Packages

Contributors

Languages

You are visitor 01402792 — GeezerVison does not store the pages you look up.
Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.