Generate Android Notifications with Code
A skill for building rich, interactive Android notifications - channels, expandable styles, actions, progress, and grouping.
Why it matters
Automate the creation of rich, interactive Android notifications using Kotlin and the NotificationCompat.Builder. This asset helps developers implement advanced notification patterns, including expandable notifications, actions, progress indicators, and grouped messages, ensuring platform best practices and performance.
Outcomes
What it gets done
Generate Kotlin code for Android notification channels (API 26+).
Create basic and advanced notification structures (BigText, BigPicture).
Implement interactive notifications with actions and PendingIntents.
Develop progress and grouped notification patterns.
Install
Add it to your toolbox
Run in your project directory:
curl -fsSL https://spark.entire.vc/get/vb-android-notification-builder | bash Overview
Android Notification Builder агент
This skill builds Android notifications with channels, expandable BigText/BigPicture styles, interactive accept/reject actions, progress bars, and grouped summary notifications. Use it when an Android notification needs to be more than a single line - expandable content, in-notification actions, progress tracking, or message grouping.
What it does
This skill builds rich, interactive, platform-optimized Android notifications using NotificationCompat.Builder and notification channels. Every notification flow starts with a channel (required on API 26+) configured with an ID, name, importance level, description, lights, and vibration pattern, before any basic notification (small icon, title, content, priority, auto-cancel) is shown. It covers advanced expandable styles - BigTextStyle for long-form content with a summary, and BigPictureStyle for image-led notifications with a large icon - plus interactive notifications with accept and reject actions wired to a BroadcastReceiver via PendingIntent.
When to use - and when NOT to
Use it when building Android notifications that need to be rich (expandable text or images), interactive (in-notification actions), or grouped and progress-tracked, not a bare single-line alert. It is not a shortcut around channel setup: channels must exist before any notification post on API 26+, and every PendingIntent should carry FLAG_IMMUTABLE on API 23+ for security.
Inputs and outputs
Given a notification's content and desired behavior, it produces: progress notifications (a determinate variant with setProgress(maxProgress, progress, false) and an ongoing flag, and an indeterminate variant with setProgress(0, 0, true)) and grouped notifications (individual messages tagged with a shared group key via setGroup, plus a summary notification using InboxStyle with a line count and setGroupSummary(true)). Interactive notifications wire accept and reject PendingIntents to a BroadcastReceiver with distinct action strings and request codes, each rendered as an addAction button on the notification.
fun createActionNotification(title: String, content: String) {
val acceptIntent = Intent(context, NotificationReceiver::class.java).apply {
action = "ACTION_ACCEPT"
}
val acceptPendingIntent = PendingIntent.getBroadcast(
context, 0, acceptIntent,
PendingIntent.FLAG_UPDATE_CURRENT or PendingIntent.FLAG_IMMUTABLE
)
val rejectIntent = Intent(context, NotificationReceiver::class.java).apply {
action = "ACTION_REJECT"
}
val rejectPendingIntent = PendingIntent.getBroadcast(
context, 1, rejectIntent,
PendingIntent.FLAG_UPDATE_CURRENT or PendingIntent.FLAG_IMMUTABLE
)
val notification = NotificationCompat.Builder(context, CHANNEL_ID)
.setSmallIcon(R.drawable.ic_notification)
.setContentTitle(title)
.setContentText(content)
.addAction(R.drawable.ic_check, "Accept", acceptPendingIntent)
.addAction(R.drawable.ic_close, "Reject", rejectPendingIntent)
.setAutoCancel(true)
.build()
NotificationManagerCompat.from(context).notify(NOTIFICATION_ID, notification)
}
Integrations
Integrates with Android's NotificationManager and NotificationManagerCompat, PendingIntent-based deep-linking back into the app, and large-icon bitmap handling optimized for performance - scaling any bitmap wider or taller than 256px down to 256x256 before attaching it as a large icon.
Who it's for
Android developers who need production-grade notification UX, not just a basic toast-style alert - following channel-management guidance (create channels at app init, use descriptive names, set HIGH importance for urgent channels and DEFAULT for routine ones, group related channels), UX guidelines (meaningful content previews, priority levels that respect user attention, proper deep-linking, dismiss-pattern support, cross-version testing, accessibility-friendly content descriptions), and security practices (no sensitive data in lock-screen previews, VISIBILITY_PRIVATE for sensitive content, validating all data before display).
FAQ
Common questions
Discussion
Questions & comments · 0
Sign In Sign in to leave a comment.