Made with heart In heart By  logo-simple Technologies

Tutorial: Guide to setup up Firebase Cloud Messaging for iOS and Android

Firebase Cloud Messaging (FCM) is a cross-platform messaging solution that lets you reliably deliver messages at no cost.

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 reengagement and retention. For use cases such as instant messaging, a message can transfer a payload of up to 4KB to a client app.

You need an iOS device and Apple Developer account to test push notifications and wont work on Simulators.

1. Creating a Project in FCM Console
create-project-step1

1. Goto Firebase Console and click on CREATE NEW PROJECT

create-project-step2

2. Click on Project Settings Gear Icon and goto project settings.

create-project-settings

1.2. How to add an iOS App to FCM Project
create-app-step1

1.Select Add Firebase to your iOS app and enter the bundle id, nickname and click ADD APP.

create-app-step2

2.Add the downloaded GoogleService-Info.plist into the root of your Xcode project by selecting all Targets.

create-app-step3

3. Pod installation steps

  1. Create a pod file if you don't have one $ pod init
  2. Open you pod file and add pod 'Firebase/Core'
  3. Save the file and run $ pod install

    create-app-step4

4.Finish the setup!

create-app-final-step

5.Upload the .P12 file

fcm-key

6.Copy the Firebase Cloud Messaging Token or Server Key(deprecated, but works) and give it to server team for Server Side implementation.

7.Goto FCM iOS Setup Guide. Download Sample iOS Code

project-setting

1.3. How to add an Android App to FCM Project
app-upload-1

1.Select Add Firebase to your Android app and enter the Package name, nickname and click ADD APP.

app-upload-2

2.Add the downloaded GoogleService-Info.json into the module root directory of your Android App.

app-upload-3

3.Gradle Steps

  1. Project-level build.gradle (project/build.gradle) classpath 'com.google.gms:google-services:3.0.0'
  2. App-level build.gradle apply plugin: 'com.google.gms.google-services'
  3. Finally, press "Sync now"in the bar that appears in the IDE

4.Finish the setup!

fcm-key-2

5.Copy the Firebase Cloud Messaging Token or Server Key(deprecated, but works) and give it to server team for Server Side implementation.

6.Goto FCM Android Setup Guide. Download Sample Android Code