Composable Function

rememberPendingIntentAction

Creates an RemoteAction that sends a PendingIntent, filling in extras when the action runs.

PendingIntentActionSample

@Sampled
@Preview
@PreviewWrapper(RemoteComponentPreviewWrapper::class)
@Composable
fun PendingIntentActionSample() {
    val launchAction = rememberPendingIntentAction { context ->
        val intent = Intent(Intent.ACTION_MAIN).setPackage(context.packageName)
        PendingIntent.getActivity(context, 0, intent, PendingIntent.FLAG_IMMUTABLE)
    }

    RemoteBox(
        modifier =
            RemoteModifier.clip(RemoteRoundedCornerShape(12.rdp))
                .background(Color(0xFF1E88E5).rc)
                .clickable(launchAction)
                .padding(16.rdp),
        contentAlignment = RemoteAlignment.Center,
    ) {
        RemoteText(text = "Open App".rs, color = Color.White.rc)
    }
}
Jetpack Compose beyond MaterialFree components, screens and templates for apps that don’t look like Google’s. Copy them into your app, or let your coding agent add them.Browse for free

Content updated: