Skip to content
Back to skills

Android Notifications

ASecurity

On Android 8.0 (API 26) and later, every notification must be posted to an existing `NotificationChannel`. If the channel ID passed to `NotificationCompat.Builder` does not exist, the notification can be silently dropped. Create the channel before posting notifications, typically from `Application.onCreate()` or before the first notification: ```kotlin private const val NOTIFICATION_CHANNEL_ID = "default" fun createNotificationChannel(context: Context) { if (Build.VERSION.SDK_INT >= Build.VER...

  • 584 stars
  • 0 votes
  • 0 copies
  • 5 views
  • Added September 5, 2026
developmentgojavakotlinapi

Works with

  • api

Security analysis

A100/100

Pro scans all 18 files and shows the line behind each finding

Scanned September 5, 2026

npx -y skills add HoangNguyen0403/agent-skills-standard --skill android-notifications --agent claude-code

Installs into .claude/skills of the current project.

Are you the author of Android Notifications?

Add the live security badge to your README. It updates with every re-scan.

Security grade badge for Android Notifications
[![Security: A — Skills Directory](https://www.skillsdirectory.com/api/skills/hoangnguyen0403-android-notifications-agent-skills-standard/badge)](https://www.skillsdirectory.com/skills/hoangnguyen0403-android-notifications-agent-skills-standard)

More formats (shields.io, HTML) on the badges page. Keep it an A: scan every change in CI with Pro.

Download with Pro
SKILL.md
On Android 8.0 (API 26) and later, every notification must be posted to an existing `NotificationChannel`. If the channel ID passed to `NotificationCompat.Builder` does not exist, the notification can be silently dropped.

Create the channel before posting notifications, typically from `Application.onCreate()` or before the first notification:

```kotlin
private const val NOTIFICATION_CHANNEL_ID = "default"

fun createNotificationChannel(context: Context) {
    if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.O) {
        val channel = NotificationChannel(
            NOTIFICATION_CHANNEL_ID,
            "Notifications",
            NotificationManager.IMPORTANCE_HIGH
        ).apply {
            description = "Application notifications"
        }

        context.getSystemService(NotificationManager::class.java)
            .createNotificationChannel(channel)
    }
}
```

Use that exact ID when building the notification and provide a valid small icon:

```kotlin
createNotificationChannel(this)

val notification = NotificationCompat.Builder(this, NOTIFICATION_CHANNEL_ID)
    .setSmallIcon(R.drawable.ic_notification)
    .setContentTitle(title)
    .setContentText(body)
    .setAutoCancel(true)
    .build()

NotificationManagerCompat.from(this).notify(notificationId, notification)
```

Also check these common causes:

- The channel may have been disabled or its importance reduced in system settings. `NotificationManagerCompat.from(context).areNotificationsEnabled()` can detect app-level blocking, but channel-level settings must also be checked by the user.
- On Android 13 (API 33) and later, the app also needs `POST_NOTIFICATIONS` runtime permission. Declare it in the manifest and request it only after explaining the benefit to the user; a service cannot show the permission prompt itself.
- If the notification comes from FCM, ensure the `FirebaseMessagingService` is declared with the `com.google.firebase.MESSAGING_EVENT` intent action. For notification taps, use a `PendingIntent` and process its extras in both `MainActivity.onCreate()` and `onNewIntent()`.

The channel must be created once with a stable ID. Changing its importance in code later will not override a user's existing channel setting, so test with a fresh install or reset the channel when validating importance changes.

Files in this skill

  • eval-1.baseline.md3.4 KB
  • eval-1.with-skill.md2.3 KB
  • eval-2.baseline.md4.9 KB
  • eval-2.with-skill.md4.1 KB
  • eval-3.baseline.md3.1 KB
  • eval-3.with-skill.md2 KB
  • trigger-1.md173 B
  • trigger-10.md124 B
  • trigger-11.md142 B
  • trigger-2.md164 B
  • trigger-3.md133 B
  • trigger-4.md151 B
  • trigger-5.md140 B
  • trigger-6.md161 B
  • trigger-7.md148 B
  • trigger-8.md133 B
  • trigger-9.md154 B

Attribution

Is this your skill, or is something wrong with this listing? Request removal or report an issue. Author removals are honored within 72 hours.

View all in development →

Comments

Loading comments…

Newsletter

Get the weekly list of safe new skills, and the ones we pulled.