How to Integrate Firebase Cloud Messaging in App?
Firebase Cloud Messaging (FCM) allows you to send push notifications to your app users.
Integrating Firebase Cloud Messaging
- For Firebase Cloud Messaging Notification, first you have to register your application with Firebase
- Create Firebase Project for Application. If you already created firebase project then you don't have to do that again.
- Firebase dependency, service class and all necessary class are already included in project
- You don't have to do extra code here
- Just download Google-service.json and replace with existing File
For iOS Push Notifications
Key-based approach (.p8)
- Log in to the Apple Developer Portal
- Navigate to Certificates, IDs & Profiles > Keys
- Click the "+" button to add a new key
- Enter a name for the key and check the APNs checkbox
- Click Continue, then Download. Note that the key can only be downloaded once
- Then go to Firebase and add this .p8 file along with Your Key ID and Team ID
Certificate-based approach (.p12)
- Log in to the Apple Developer Portal
- Navigate to Certificates, IDs & Profiles > Identifiers > App IDs and click the App ID associated with your app
- On the screen for your App ID, check Capabilities > Push Notifications
- Click Save and respond to the Modify App Capabilities dialog box that appears
- To create the certificate, we will use to communicate with Apple when sending push notifications
- In a new browser tab, follow Apple's Create a certificate signing request instructions
- In the Apple Developer Portal, navigate back to your App ID
- Click Capabilities > Push Notifications > Configure
- Accept the default .p12 file format and click Save. Respond to the prompts, and enter a password for the file if necessary
- Keep track of this file, since you'll upload it to firebase in a later step