Understanding Firebase Cloud Messaging on iOS - Firecasts

By: Firebase

110   4   12082

Uploaded on 01/09/2017

Read the Firebase Cloud Messaging, on iOS documentation: https://goo.gl/0dBp4n

So maybe you know by now that Firebase Cloud Messaging can route messages through APNs to talk to your iOS devices. But do you know how it does this? Find out how, along with a brief discussion about FCM method swizzling, and why you might want to talk to the FCM service directly, in this episode of Firecasts.

Add the Firecasts playlist! https://goo.gl/n2XqG1

Subscribe to the brand new Firebase Channel: https://goo.gl/9giPHG

Comments (5):

By anonymous    2017-09-20

You should send data payload in your FCM message. Data payload gets received in on message method irrespective of your app being in foreground or background. Handle the action there. Like show notification by reading the data payload always, or if you want show an alert dialog when your app is open or in the foreground.

here is a sample payload:

  "to": "registration_id_or_topic",
  "data": {
        "message": "This is a Firebase Cloud Messaging Topic Message!",
        "youtubeURL": "https://youtu.be/A1SDBIViRtE"

Then in your onMessageReceived:

public void onMessageReceived(RemoteMessage remoteMessage) {
   if (remoteMessage.getData().size() > 0) {
        Log.d(TAG, "Message data payload: " + remoteMessage.getData());
        Map<String, String> receivedMap = remoteMessage.getData();
        String youtubeURL = receivedMap.get("youtubeURL");

you can easily implement showNotificationWithURLAction(...) method by googling it out. One sample is here

Original Thread

By anonymous    2017-09-20

Yes, it's possible. FCM routes all of your iOS notifications to APNs, so by the time these notifications reach your iOS device, they look just like any other iOS notification.

If you want all the nitty-gritty details, this video might help.

Original Thread

By anonymous    2017-11-27

A app can send notifications to remote devices using server key and device InstanceToken. Now as the instanceToken is something that keeps on changing every time the user installs the application. The app uses this instanceToken to send notification to other users.

How can the instanceToken be updated every time user uninstalls and installs the application, so that when other user sends notification its provided to the same user

Have seen the use of this method in AppDelegate in quite a few place, need a expert who can help in understanding the logic behind it or assist in crafting a better method

NotificationCenter.default.addObserver(self, selector: 
#selector(self.tokenRefreshNotification(notification:)), name: 
NSNotification.Name.InstanceIDTokenRefresh, object: nil)

The best resources that one could find is docs and video from firecast team video

Original Thread

Submit Your Video

If you have some great dev videos to share, please fill out this form.