Skip to content

hiteshsarsava/cardscanner

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

13 Commits
 
 
 
 

Repository files navigation

This Library will help you to implement scan the card(Credit Card, Debit Card) details. It will help you to save your time and mistakes.

Set Up

1. Add it in your project level build.gradle at the end of repositories:

allprojects {
		repositories {
			maven { url 'https://jitpack.io' }
		}
	}

2. Add the dependency:

dependencies {
          implementation 'com.github.hiteshsarsava:cardscanner:${latestVersion}' //e.g., v0.0.1
  }

latestVersion :

How to use it

1. Prepare activity result:

private val resultLauncher =
      registerForActivityResult(ActivityResultContracts.StartActivityForResult()) { result ->
          if (result.resultCode == Activity.RESULT_OK) {
              // There are no request codes
              val data: Intent = result.data ?: return@registerForActivityResult
              val cardDetails: CardDetails =
                  if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.TIRAMISU) {
                      data.getSerializableExtra(
                          ScannerActivity.CARD_DETAILS,
                          CardDetails::class.java
                      ) as CardDetails
                  } else {
                      data.getSerializableExtra(ScannerActivity.CARD_DETAILS) as CardDetails
                  }
              setCardData(cardDetails)
          }
      }
      

2. Launch Activity:

resultLauncher.launch(Intent(this@MainActivity, ScannerActivity::class.java))

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Packages

No packages published

Languages