Skip to content
Back to skills

Push Notification Setup

ASecurity

Implements push notifications across iOS, Android, and web using Firebase Cloud Messaging and native services. Use when adding notification capabilities, handling background messages, or setting up notification channels.

  • 222 stars
  • 0 votes
  • 0 copies
  • 2 views
  • Added February 7, 2026
developmentjavascriptjavaswiftkotlinreact

Security analysis

A100/100

Scanned February 12, 2026

npx -y skills add secondsky/claude-skills --skill push-notification-setup --agent claude-code

Installs into .claude/skills of the current project.

Are you the author of Push Notification Setup?

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

Security grade badge for Push Notification Setup
[![Security: A — Skills Directory](https://www.skillsdirectory.com/api/skills/secondsky-push-notification-setup/badge)](https://www.skillsdirectory.com/skills/secondsky-push-notification-setup)

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
---
name: push-notification-setup
description: Implements push notifications across iOS, Android, and web using Firebase Cloud Messaging and native services. Use when adding notification capabilities, handling background messages, or setting up notification channels.
keywords: push notifications, FCM, Firebase Cloud Messaging, iOS notifications, Android notifications, web notifications, React Native notifications, notification permissions, background messages, notification channels, APNS, APNs, notification tokens, remote notifications, foreground notifications, notification handlers
---

# Push Notification Setup

Implement push notifications across mobile and web platforms.

## Firebase Cloud Messaging (React Native)

```javascript
import messaging from '@react-native-firebase/messaging';

// Request permission
async function requestPermission() {
  const status = await messaging().requestPermission();
  if (status === messaging.AuthorizationStatus.AUTHORIZED) {
    const token = await messaging().getToken();
    await sendTokenToServer(token);
  }
}

// Handle foreground messages
messaging().onMessage(async message => {
  console.log('Foreground message:', message);
  showLocalNotification(message);
});

// Handle background/quit messages
messaging().setBackgroundMessageHandler(async message => {
  console.log('Background message:', message);
});

// Handle token refresh
messaging().onTokenRefresh(token => {
  sendTokenToServer(token);
});
```

## iOS Native (Swift)

```swift
import UserNotifications

func requestAuthorization() {
    UNUserNotificationCenter.current().requestAuthorization(options: [.alert, .badge, .sound]) { granted, error in
        if granted {
            DispatchQueue.main.async {
                UIApplication.shared.registerForRemoteNotifications()
            }
        }
    }
}

func application(_ application: UIApplication, didRegisterForRemoteNotificationsWithDeviceToken deviceToken: Data) {
    let token = deviceToken.map { String(format: "%02.2hhx", $0) }.joined()
    sendTokenToServer(token)
}
```

## Android (Kotlin)

```kotlin
class MyFirebaseService : FirebaseMessagingService() {
    override fun onNewToken(token: String) {
        sendTokenToServer(token)
    }

    override fun onMessageReceived(message: RemoteMessage) {
        message.notification?.let {
            showNotification(it.title, it.body)
        }
    }

    private fun showNotification(title: String?, body: String?) {
        val channelId = "default"
        val notification = NotificationCompat.Builder(this, channelId)
            .setContentTitle(title)
            .setContentText(body)
            .setSmallIcon(R.drawable.ic_notification)
            .build()

        NotificationManagerCompat.from(this).notify(0, notification)
    }
}
```

## Best Practices

- Request permission at appropriate time
- Handle token refresh
- Support notification channels (Android)
- Implement deep linking
- Never send sensitive data in payload
- Test on real devices

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.

Comments

Loading comments…