Send Push Notifications to Your iOS App With Firebase Cloud Messaging

Continuing our series on Firebase, in this post we'll take a look at Firebase Cloud Messaging—or FCM for short—Google’s low-latency message and notification orchestration service for mobile apps. 

For as long as iPhones have been around, push notifications have played a crucial role in notifying users at predetermined times of important events, whether a notification of a Skype message or call, a direct message on Twitter, or gaming alerts. Through carefully crafted, segmented push notifications, marketers have boosted app engagement and user retention. You can do the same, by leveraging FCM to:

  • target predefined or custom user segments, taking advantage of demographics and user behavior

  • deliver immediate or scheduled push notifications

  • integrate FCM into Google Analytics to provide detailed conversation monitoring and perform A/B testing

  • create a fully immersing instant messaging application

Assumed Knowledge

This tutorial assumes you have a working knowledge of iOS and Swift, as well as some basic experience with CocoaPods. If you need to learn more, check out our Swift tutorials and CocoaPods tutorials.

Objectives of This Article 

In this article, you will learn all about FCM, as we will be covering the following topics:

  • setup of an FCM project

  • configuring your environment for FCM

  • receiving and handling messages

  • sending a message to your device

  • topic and group messaging

  • targeting segments and analytics

What Is Firebase Cloud Messaging (FCM)?

Concisely put, Firebase Cloud Messaging—or FCM for short—is a cross-platform cloud messaging and notification solution from Google, enabling developers to send push notifications to their app's end users through the Firebase Notification Composer, or a Firebase-exposed set of APIs. FCM supports two types of messages: notification messages and data messages.

Notification messages are explicit push notification messages that display on the user’s device, to either inform or solicit engagement, such as a Facebook Messenger message notification. Data messages, by contrast, are directly processed by the application in the background and can be used to update a table view without the app in the foreground. 

Through message targeting, FCM can deliver messages to single devices, groups of devices, or devices subscribed to topics. The targeted groups directly integrate with Firebase Analytics, so that you can track engagement and conversions, crafting purposeful customer segments. Next, we are going to go through the process of setting up a Firebase project for iOS.

Read the rest of my article, and learn how to implement this, exclusively on Tuts+.

Doron Katz