Properties used to customize the behavior of a [Popup].
@Composable
fun PopupFromServiceSample() {
// In a real Service scenario, appWindowToken would be received via IPC
// from the main application process. This sample simulates having the token.
val appWindowToken: IBinder? = null // Provided via IPC
var showPopup by remember { mutableStateOf(false) }
Button(onClick = { showPopup = true }) { Text("Show Popup From Service") }
if (showPopup) {
Popup(
onDismissRequest = { showPopup = false },
properties =
PopupProperties(
// Pass the application's window token
windowToken = appWindowToken
),
) {
Box(Modifier.size(200.dp, 100.dp).background(Color.Blue.copy(alpha = 0.8f))) {
Text("Popup Content (Service)", color = Color.White)
}
}
}
}