Challenge 2: Requesting the Permission from Compose — Solution @Composable fun NotificationPermissionSection() { val context = LocalContext.current var isGranted by remember { mutableStateOf( ContextCompat.checkSelfPermission(context, Manifest.permission.POST_NOTIFICATIONS) == PackageManager.PERMISSION_GRANTED ) } val launcher = rememberLauncherForActivityResult( contract = ActivityResultContracts.RequestPermission() ) { granted -> isGranted = granted } if (isGranted) { Text("Notifications are enabled") } else { Button(onClick = { launcher.launch(Manifest.permission.POST_NOTIFICATIONS) }) { Text("Enable Notifications") } } } Notes: - The initial isGranted value is computed ONCE, at first composition, using ContextCompat.checkSelfPermission — this correctly reflects whatever the permission state already was (e.g. if granted in a previous session, the Button never even needs to show). - launcher.launch(...) triggers the actual system permission dialog; the composable itself doesn't control what that dialog looks like or when it dismisses — only what happens with the resulting Boolean via the lambda passed to rememberLauncherForActivityResult. - isGranted is a remembered mutableStateOf (Course 2, Chapter 1 pattern), so updating it inside the launcher's callback automatically triggers recomposition — the UI switches from the Button to the "enabled" text the moment the user grants the permission, with no manual refresh needed.