Skip to content
Back to skills

Android Notifications

ASecurity

No. On Android 13 (API 33) and later, request `POST_NOTIFICATIONS` at a contextually useful point after explaining why notifications help. Do not show the system prompt unconditionally on the first app launch; a short priming dialog improves the user's understanding and avoids an unexpected permission request. Declare the permission: ```xml <uses-permission android:name="android.permission.POST_NOTIFICATIONS" /> ``` Register a launcher in an activity and guard it by API level and current perm...

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

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-fd8a38b9/badge)](https://www.skillsdirectory.com/skills/hoangnguyen0403-android-notifications-fd8a38b9)

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
No. On Android 13 (API 33) and later, request `POST_NOTIFICATIONS` at a contextually useful point after explaining why notifications help. Do not show the system prompt unconditionally on the first app launch; a short priming dialog improves the user's understanding and avoids an unexpected permission request.

Declare the permission:

```xml
<uses-permission android:name="android.permission.POST_NOTIFICATIONS" />
```

Register a launcher in an activity and guard it by API level and current permission state:

```kotlin
private val notificationPermissionLauncher =
    registerForActivityResult(ActivityResultContracts.RequestPermission()) { granted ->
        if (granted) {
            // Notifications can now be posted.
        } else {
            // Respect the decision; offer notification settings later if useful.
        }
    }

private fun requestNotificationPermissionIfNeeded() {
    if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.TIRAMISU &&
        checkSelfPermission(Manifest.permission.POST_NOTIFICATIONS) !=
            PackageManager.PERMISSION_GRANTED
    ) {
        notificationPermissionLauncher.launch(Manifest.permission.POST_NOTIFICATIONS)
    }
}
```

Call that function only after a priming explanation, for example when the user enables alerts or reaches a feature that depends on them:

```kotlin
AlertDialog.Builder(this)
    .setTitle("Enable notifications?")
    .setMessage("Get timely updates about your orders.")
    .setPositiveButton("Continue") { _, _ ->
        requestNotificationPermissionIfNeeded()
    }
    .setNegativeButton("Not now", null)
    .show()
```

Create the app's `NotificationChannel` separately on Android 8+ before posting notifications. The runtime permission and the channel are different gates: API 33+ requires both the permission and a valid channel, while older Android versions do not use `POST_NOTIFICATIONS`. If the user denies the request, do not repeatedly prompt; respect the choice and provide a settings route at an appropriate later point if the product needs one.

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.