Open RhymezxCode opened 7 months ago
Hi, could you please show me full code of Activity where you try to use it ? Do you have a problem only on Android 13?
I currently use Android 13 so that is when noticed it. The demo app on google play also have the same problem, try testing on Android 13 or 14
Then you use demo app from Google Play, did scanner "catch" your card and next screen "Card details" is with empty fields or scanner can't "catch" card?
The camera fully captures the card, but it doesn't leave that screen, even after waiting for a long time. Not detail page is opened as well
What card type do you use? Lens24 supports only Visa and MC (16 digits), but not American Express, JCB
I tested with a MasterCard and Visa card.
@vlasentiy there you go
class CardOptionSelection : AppCompatActivity(), View.OnClickListener {
private lateinit var binding: ActivityCardOptionSelectionBinding
//bundle data
private var bundle: Bundle = Bundle()
private var activityResultCallback = ScanCardCallback.Builder()
.setOnSuccess { card: Card, bitmap: Bitmap? -> setCard(card) }
.setOnBackPressed { finish() }
.setOnError {
Snackbar.make(
findViewById(android.R.id.content),
"Something went wrong!",
Snackbar.LENGTH_LONG
).show()
}
.build()
private var startActivityIntent = registerForActivityResult(
ActivityResultContracts.StartActivityForResult(),
activityResultCallback
)
override fun onCreate(savedInstanceState: Bundle?) {
super.onCreate(savedInstanceState)
overridePendingTransition(android.R.anim.fade_in, android.R.anim.fade_out)
binding = ActivityCardOptionSelectionBinding.inflate(layoutInflater)
setContentView(binding.root)
binding.cardNumber.setOnClickListener(this)
binding.cardOcr.setOnClickListener(this)
}
private fun setCard(card: Card) {
bundle.putString("cardNumber", card.cardNumber)
startActivity(
Intent(
this,
OCRconfirm::class.java
).putExtras(bundle)
)
}
private fun scanCard() {
val intent: Intent = ScanCardIntent.Builder(this)
// customize these values to suit your needs
.setVibrationEnabled(true)
.setHint("Please kindly scan your card")
.setToolbarTitle("Scan your card")
.setSaveCard(false)
.setBottomHint("Please kindly place your card in the box above!")
.setMainColor(R.color.colorPrimary)
.build()
startActivityIntent.launch(intent)
}
override fun onClick(v: View?) {
if (v != null) {
when (v.id) {
R.id.card_number -> startActivity(Intent(this,
CardProcessor::class.java))
R.id.card_ocr -> {
scanCard()
}
}
}
}
}
I used this method, no luck