Paper Receipt Android SDK 2.4.0
A newer release is available. Paper Receipt Android SDK 2.4.1 fixes an out-of-memory crash at the end of a scan.
2.4.0 builds on 2.3.1 and ships together with Activation SDK 1.2.0. Its headline changes:
- Return receipts.
ScanResults.isReturn()reports whether a receipt is a return rather than a purchase. - Camera UI support for Activation's Error Flows. The camera can now pause on a captured photo while Activation decides what to do with the scan, then add another photo to the same scan or finish it.
- Steadier scan sessions. Text from a previous scan no longer leaks into the next one, and coming back from the background no longer restarts a scan in progress.
Every Paper Receipt module in this release is source- and binary-compatible with 2.3.1. The breaking changes in this pairing are in the Activation SDK — see the Activation 1.2.0 release notes.
Installation
Bump the BOM to 2.4.0. If you also use the Activation SDK, bump its BOM to 1.2.0 at the same time (see the Android SDK Version Matrix).
dependencies {
implementation(platform("com.microblink.blinkreceipt:blinkreceipt-bom:2.4.0"))
implementation("com.microblink.blinkreceipt:blinkreceipt-recognizer")
implementation("com.microblink.blinkreceipt:blinkreceipt-camera-ui")
// Only if you use Activation
implementation(platform("com.actualplatform:activation-bom:1.2.0"))
implementation("com.actualplatform:activation")
}
The build requirements are unchanged from 2.3.1: compileSdk 37 (or higher) and minSdk 24. Your app's targetSdk does not need to change.
What's new
ScanResults.isReturn(). The receipt-level return verdict, from the camera, direct-OCR, and PDF scan paths alike, as well as for web and missed-earnings receipts. It defaults tofalse, matches the iOS SDK, and needs no integration changes.ScanResults.Builder.isReturn(boolean)sets it. SeeScanResults.CameraView.suspendCamera()andresumeCamera(LifecycleOwner). A sticky camera unbind alongside the existingpauseCamera().pauseCamera()is undone by the nextstartCamera()or lifecycle resume;suspendCamera()keeps the camera unbound —startCamera()does nothing — untilresumeCamera(lifecycleOwner)clears it and rebinds. While suspended, a permission revoked under an overlay can't fireonPermissionDenied().BitmapFrame.resetParser()andresetParser(boolean). Say explicitly whether a frame starts a new receipt. When never set, the previous behavior applies — a frame withframeIndex() <= 0starts a new receipt — so existing integrations are unaffected; an explicitfalseon frame 0 is now honored.- Camera UI support for Activation's Error Flows. For Activation scans, the camera can halt capture while keeping the scan session open and the camera frozen on the captured photo, then either resume capture to add another photo to the same scan or finish it. This backs the review screens introduced in Activation
1.2.0; it applies to Activation scans only. - Updated recognition engine. The bundled receipt parser is updated to v1.55.1.
Changed
CameraRecognizerActivity survives more configuration changes
CameraRecognizerActivity now also handles smallestScreenSize, uiMode, locale, fontScale, and density configuration changes itself, and declares windowSoftInputMode="adjustResize". A live scan now survives dark-mode, locale, font-scale, and density changes instead of being restarted. If your app relied on the Activity being recreated for those changes, it no longer is.
Other changes
CameraRecognizerActivityfinishes when launched without scan options, instead of logging and showing a blank screen.ScanResultsParcel layout. The new return flag is written in the middle of theScanResultsParcel. PassingScanResultsthrough Intents, Bundles, orSavedStateHandleis unaffected, and so is field-based persistence such as JSON, which reads older results as non-returns. Only an app that savesScanResultsas raw Parcel bytes and reads them back after upgrading would misread them — clear that cache on upgrade.- A warning is logged when a new scan session starts while a previous one still holds an in-progress receipt that is about to be discarded.
Fixed
- Text from a previous scan could carry into the next one, producing duplicated or merged content in
ScanResults. This was most often hit by re-entering the camera screen while a scan was still in flight. - A merchant-logo detection failure discarded the frame. The frame now continues to OCR.
- Frames were lost when a
HARDWARE-config bitmap was passed throughImageClient. Such bitmaps are now copied asARGB_8888instead of throwing. - Returning from the background re-requested camera permission and re-ran scan setup on a scan already in progress. Permission is now requested once per camera screen, and repeated setup can no longer handle scan updates twice.
- A finished scan session could be picked up by the next camera visit. The camera UI now tracks which session it started, across configuration changes, and never ends a session your app opened itself.
- Delivering a scan result could race the end of the scan. Results are now delivered only after the recognizer has finished its end-of-session work, and the camera UI's internal timeouts pause while your app is in the background.
- The live camera briefly showed through while the Activation Receipt Summary was closing.
- Fields still being looked up were shown as not captured in the camera UI's live results. They are now left out until the final result is known.
Upgrade checklist
- Bump the Paper Receipt BOM to
2.4.0— and, if you use Activation, the Activation BOM to1.2.0, working through the Activation 1.2.0 upgrade checklist. - If you rely on
CameraRecognizerActivitybeing recreated on dark-mode, locale, font-scale, or density changes, handle those changes another way. - If you persist
ScanResultsas raw Parcel bytes, clear that cache on upgrade. - Optionally read
ScanResults.isReturn()to treat return receipts differently.