Firebase Cloud Messaging (FCM), formerly called Google Cloud Messaging (GCM), is a free cloud service from Google that allows app developers to send notifications and messages to users across a variety of platforms, including Android, iOS and web applications. FCM is provided by Firebase, a company acquired by Google in 2014.
Using FCM, you can notify a client app that new email or other data is available to sync. You can send notification messages to drive user re-engagement and retention. For use cases such as instant messaging, a message can transfer a payload of up to 4KB to a client app. You can read more detailed description.
You can clone our sample or build your own Rhodes app for testing FCM.
Go to https://console.firebase.google.com and create Firebase Project.
Fill project name field
Add Google analytics to your project if it you need in it
You need to get the APNs Auth key (preferred) or the SSL certificate for Apple Push Notifications service (APNs). You can find more details in the article “Configuring APNs with FCM”. Also don’t forget to obtain Apple provision profile with Push Notification capability.
Press iOS icon under the caption “Get started by adding Firebase to your app” or go to Project settings and add the “Add app” button in General Settings. You can reach Project Settings by pressing the icon “Gear” on the right of the project title at the left top of screen.
Adding iOS to your Firebase project steps:
Go to the Project Settings >>Cloud Messaging Settings and upload APNs Auth key, specify Key ID and you Apple development team ID.
Press Android icon under the caption “Get started by adding Firebase to your app” or go to Project settings and add the “Add app” button in General Settings. You can reach Project Settings by pressing the icon “Gear” on the right of the project title at the left top of screen. Adding Android to your Firebase project steps:
Now all are ready for building the apps and install it on the devices.
Run the following commands:
rake build:iphone:setup_xcode_project
rake device:iphone:production
Open xCode and install the .ipa file to your iOS device. Run the app and it shows the device identifier. The device identifier is required for sending the push messages. It is a long string, so it will be better to copy it from the app’s logs. You can get access to the app’s logs if start the app via xCode.
Run the following command:
rake run:android:device
Run the app and it shows the device identifier. The device identifier is required for sending the push messages. It is a long string, so it will be better to copy it from the app logs. You can get access to the app’s logs by the command:
adb logcat -s APP
Go to console.firebase.google.com, open your project >> Grow >>Cloud Messaging. Press “Send your first message” button.
Fill the Notification Title and Notification Text fields, then press “Send test message” button.
Add your device identifiers for iOS app and Android App and press “Test” button. Your apps must show the received push notification.