push-notification-setup

Push Notification Setup

Safety Notice

This listing is imported from skills.sh public index metadata. Review upstream SKILL.md and repository scripts before running.

Copy this and send it to your AI assistant to learn

Install skill "push-notification-setup" with this command: npx skills add secondsky/claude-skills/secondsky-claude-skills-push-notification-setup

Push Notification Setup

Implement push notifications across mobile and web platforms.

Firebase Cloud Messaging (React Native)

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)

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)

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

Source Transparency

This detail page is rendered from real SKILL.md content. Trust labels are metadata-based hints, not a safety guarantee.

Related Skills

Related by shared tags or category signals.

General

tailwind-v4-shadcn

No summary provided by upstream source.

Repository SourceNeeds Review
General

aceternity-ui

No summary provided by upstream source.

Repository SourceNeeds Review
General

playwright

No summary provided by upstream source.

Repository SourceNeeds Review
General

zod

No summary provided by upstream source.

Repository SourceNeeds Review