Every Chainway UHF handheld — C72, C71, C66, C5, and others in the same UART-based reader family — ships sample code built around RFIDWithUHF. Every one of those SDK builds also marks that same class deprecated, pointing at RFIDWithUHFUART as the forward-compatible replacement. Almost no integrator reads far enough into the SDK's Javadoc-equivalent comments to notice.
What the vendor docs don't tell you
The deprecation isn't a rumor or a forum post — it's an annotation in the SDK's own class definition. It just never made it into the sample apps that most integrators actually copy from.
What the docs don't tell you
RFIDWithUHF was retained for backward compatibility with apps built against Chainway's earliest UHF SDK generation, before the company standardized on a UART transport layer across its handheld line. New devices are validated against RFIDWithUHFUART internally; RFIDWithUHF receives no further testing beyond "does it still compile," which means edge-case behavior (buffer overflow handling, reconnect-after-sleep) can silently diverge between the two classes on newer firmware even when both technically still run.
Why this matters for production
A demo app that works during a five-minute vendor evaluation and a production deployment that runs eight hours a day for a year are different reliability bars. The obsolete API's untested edge cases are exactly the paths that only surface under sustained production load — buffer overflow during a long inventory session, reconnect behavior after the device sleeps, and UART port contention across app restarts.
Migration map
| Obsolete (RFIDWithUHF) | Current (RFIDWithUHFUART) | Notes |
|---|---|---|
new RFIDWithUHF() | RFIDWithUHFUART.getInstance() | Current class is a singleton; do not attempt to instantiate directly |
.init(context) | .init() | UART variant does not take a context parameter in most SDK builds |
.uhfGetTagInfo() | .readTagFromBuffer() | Naming and return-type shape both changed; check nullability handling |
.startScan() | .startInventoryTag() | Functionally equivalent trigger for antenna sweep |
.stopScan() | .stopInventory() | Equivalent teardown call |
.close() | .free() | Must be called in onPause(), not only onDestroy(), to release the UART port reliably |
.setPower(int) | .setPower(int) | Signature unchanged; range still 5–30 dBm on most firmware |
Migration steps
Migrating a live app off RFIDWithUHF is mechanical if the reader access is already isolated behind a wrapper class, and a larger refactor if it isn't.
// Before
class LegacyRfidManager(private val context: Context) {
private val reader = RFIDWithUHF()
fun start() {
reader.init(context)
reader.startScan()
}
fun read(): TagInfo? = reader.uhfGetTagInfo()
fun stop() {
reader.stopScan()
reader.close()
}
}
// After
class RfidManager {
private val reader = RFIDWithUHFUART.getInstance()
fun start(): Boolean {
val ok = reader.init()
if (ok) reader.startInventoryTag()
return ok
}
fun read(): UHFTagInfo? = reader.readTagFromBuffer()
fun stop() {
reader.stopInventory()
}
fun release() {
reader.free()
}
}- Isolate all direct
RFIDWithUHFcalls behind a single manager class if they aren't already — this is the highest-leverage refactor for the migration and pays for itself on the next SDK bump too. - Swap the class reference and method names per the migration map above.
- Add an explicit
release()/free()call to the hosting Activity or Fragment'sonPause(). The old.close()call was more forgiving about when it ran;.free()on the UART class needs to run before the process can be backgrounded safely. - Re-test the trigger-key integration path specifically — keycode handling didn't change, but any code that assumed
RFIDWithUHF's buffer behavior around rapid trigger press/release cycles should be re-verified against the UART class's buffer semantics.
Common errors
| Error | Cause | Fix |
|---|---|---|
App builds and runs fine on RFIDWithUHF, then reads stop after a firmware update | Deprecated class's edge-case behavior diverged from RFIDWithUHFUART on newer firmware | Migrate to RFIDWithUHFUART proactively rather than reactively after a firmware-triggered failure |
NoSuchMethodError after migrating partway | Mixed calls from both classes left in the codebase | Grep the codebase for RFIDWithUHF( (not RFIDWithUHFUART) to find any remaining direct instantiations |
| UART port locked after migration | .free() not called where .close() used to be | Confirm release()/free() is wired into onPause(), not just onDestroy() |
| Buffer behavior differs under rapid trigger presses | Buffer semantics differ subtly between the two classes | Re-test trigger-key rapid press/release specifically post-migration; don't assume parity from the migration map alone |