Menu

1 / 5

The Launcher That Outlives Your UI: Field Notes on rememberLauncherForActivityResult

DEV Community: kotlin·Android Expert·about 6 hours ago
#6QhcFNdG
#devtokotlin#devto#dev#launcher#launch
Reading 0:00
15s threshold

Compose makes calling system UI feel like calling a function. The catch is that the callee can outlive the caller, and your process can die in the middle of the call.

Why this API deserves a senior-level look

Most Compose code you write is a pure function of state. rememberLauncherForActivityResult is one of the few places where a composable negotiates with something outside your process: the camera app, the system photo picker, a permission dialog, a billing sheet. The call looks synchronous in your code, but the system is free to destroy your activity, or your whole process, before the answer comes back.

The API handles that surprisingly well, and it still has sharp edges that only show up on real devices, in the hands of real users, under memory pressure.…

Continue reading — create a free account

Join HashtagPLUS to read full articles, follow hashtags, vote, and join the conversation.