<< All versions
Skill v1.0.1
currentLLM-judged scan95/100secondsky/claude-skills/push-notification-setup
3 files
──Details
PublishedMay 30, 2026 at 06:36 AM
Content Hashsha256:65d693ac766b9721...
Git SHA5e92b7170451
Bump Typepatch
──Files
Files (1 file, 3.0 KB)
SKILL.md3.0 KBactive
SKILL.md · 101 lines · 3.0 KB
version: "1.0.1" 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. metadata: 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" license: MIT
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 permissionasync function requestPermission() {const status = await messaging().requestPermission();if (status === messaging.AuthorizationStatus.AUTHORIZED) {const token = await messaging().getToken();await sendTokenToServer(token);}}// Handle foreground messagesmessaging().onMessage(async message => {console.log('Foreground message:', message);showLocalNotification(message);});// Handle background/quit messagesmessaging().setBackgroundMessageHandler(async message => {console.log('Background message:', message);});// Handle token refreshmessaging().onTokenRefresh(token => {sendTokenToServer(token);});
iOS Native (Swift)
swift
import UserNotificationsfunc requestAuthorization() {UNUserNotificationCenter.current().requestAuthorization(options: [.alert, .badge, .sound]) { granted, error inif 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