firebase-messaging

Featured

Use when setting up Firebase Cloud Messaging, managing permissions and tokens, handling background/foreground notification taps, or dispatching messages server-side (HTTP v1).

API & Backend 619 stars 60 forks Updated today MIT

Install

View on GitHub

Quality Score: 95/100

Stars 20%
93
Recency 20%
100
Frontmatter 20%
70
Documentation 15%
100
Issue Health 10%
50
License 10%
100
Description 5%
100

Skill Content

# Firebase Cloud Messaging Skill This skill defines how to correctly use Firebase Cloud Messaging (FCM) in Flutter applications. ## When to Use Use this skill when: * Setting up push notifications with FCM in a Flutter project. * Handling messages in foreground, background, and terminated states. * Managing notification permissions and FCM tokens. * Configuring platform-specific notification display behavior. --- ## 1. Setup and Configuration ``` flutter pub add firebase_messaging ``` **iOS:** - Enable **Push Notifications** and **Background Modes** in Xcode. - Upload your **APNs authentication key** to Firebase before using FCM. - Do **not** disable method swizzling — it is required for FCM token handling. - Ensure the bundle ID for your APNs authentication key matches your app's bundle ID. **Android:** - Devices must run **Android 4.4+** with Google Play services installed. - Check for Google Play services compatibility in both `onCreate()` and `onResume()`. **Web:** - Create and register a service worker file named `firebase-messaging-sw.js` in your `web/` directory: ```js importScripts("https://www.gstatic.com/firebasejs/10.7.0/firebase-app-compat.js"); importScripts("https://www.gstatic.com/firebasejs/10.7.0/firebase-messaging-compat.js"); firebase.initializeApp({ /* your config */ }); const messaging = firebase.messaging(); messaging.onBackgroundMessage((message) => { console.log("onBackgroundMessage", message); }); ``` --- ## 2. Message Handling **Fo...

Details

Author
evanca
Repository
evanca/flutter-ai-rules
Created
1 years ago
Last Updated
today
Language
Shell
License
MIT

Integrates with

Similar Skills

Semantically similar based on skill content — not just same category