capacitor-push-notifications
Complete guide to implementing push notifications in Capacitor apps using Firebase Cloud Messaging (FCM) and Apple Push Notification Service (APNs). Covers setup, handling, and best practices. Use this skill when users need to add push notifications.
By cap-go · 931 installs
npx skills add cap-go/capgo-skills --skill capacitor-push-notifications
Source repository · Upstream listing
Push Notifications in Capacitor
Implement push notifications for iOS and Android using Firebase and APNs.
When to Use This Skill
User wants push notifications
User needs FCM setup
User asks about APNs
User has notification issues
User wants rich notifications
Quick Start
Install Plugin
Basic Implementation
Firebase Setup
1. Create Firebase Project
1. Go to https://console.firebase.google.com
2. Create new project
3. Add iOS and Android apps
2. Android Configuration
Download google services.json to android/app/
3. iOS Configuration
Download GoogleService Info.plist to ios/App/App/
4. iOS Capabilities
In Xcode:
1. Select App target
2. Signing & Capabilities
3. Add "Push Notifications"
4. Add "Background Modes" "Remote notifications"
APNs Key Setup (iOS)
Create APNs Key
1. Go to https://developer.apple.com/account
2. Certificates, IDs & Profiles
3. Keys Create Key
4. Enable Apple Push Notifications service (APNs)
5. Download .p8 file
Add to Firebase
1. Firebase Console Project Settings
2. Cloud Messaging tab
3. iOS app configuration
4. Upload APNs Authentication Key (.p8)
5. Enter Key ID and Team ID
Sending Notifications
Firebase Admin SDK (Node.js)
HTTP v1 API
Advanced Features
Notification Channels (Android)
Topic Subscription
Rich Notifications (iOS)
Notification Actions
Background Handling
Data Only Notifications
Local Notifications Fallback
Best Practices
Permission Handling
Token Refresh
Error Handling
Troubleshooting
iOS Not Receiving
1. Check APNs key in Firebase
2. Verify Push Notifications capability
3. Check provisioning profile
4. Verify device token format
5. Test with Firebase Console
Android Not Receiving
1. Verify google services.json
2. Check notification channel exists
3. Verify FCM token
4. Check battery optimization
5. Test with Firebase Console
Common Issues
Issue Solution
No token Check permissions, network
Foreground only Implement background handler
Delayed delivery Use high priority, data only
No sound Configure notification channel
Badge not updating Set badge in payload
Resources
Capacitor Push Notifications: https://capacitorjs.com/docs/apis/push notifications
Firebase Cloud Messaging: https://firebase.google.com/docs/cloud messaging
APNs Documentation: https://developer.apple.com/documentation/usernotifications