Writing Kotlin for Sunmi POS terminals is like Android development but everything is trying to kill you.
The Sunmi V2 Pro runs Android 7.1, from 2017. Half the Jetpack libraries do not support it. You are writing Kotlin with one hand tied behind your back because your target API level is from the era when people still thought Android Wear was going to be a thing.
The thermal printer is the star of the show. It runs on a system service that blocks the main thread for 200-400ms every time it prints a receipt. You will get ANR dialogs if you are not careful. We offload everything to a background dispatcher through a coroutine-based print queue. That took two weeks to get right because the Sunmi SDK documentation is written in a language that is technically English but spiritually Mandarin.
Payment integration is where it gets spicy. Stone, Rede, Cielo, each payment provider has their own SDK with their own lifecycle, their own callback patterns, and their own creative interpretation of what "success" means. We built an abstraction layer that normalizes all of them into a single PaymentResult sealed class. Every new provider is just a new adapter. Clean Architecture saves lives here.
The 5.5 inch screen leaves little room for fancy layouts, so we have to make every pixel count. We learned to design for the terminal first and then adapt for tablets, not the other way around. Restaurant staff are using this thing during a Saturday dinner rush with greasy hands. They need big buttons and clear feedback so there is no ambiguity about what happened.
Testing on real hardware is non-negotiable. The emulator lies to you. It has neither the thermal printer nor the NFC reader, and it misses the timing quirks of the Sunmi Android fork. We keep four physical terminals on the team's desks and every PR gets tested on metal before merge.
It is not glamorous work. Nobody writes Medium articles about Kotlin on a restaurant POS. But this code processes real money for real restaurants every single day, and when it breaks, someone does not get paid. That changes how you write every line.