1
votes

I'm using FCM to publish push notifications to my users, which is working great so far.

Currently I'm trying to implement a Notification Content Extension to deliver customized push notification and previews, which is working great with local notifications, following this post. As far I know, I have to set the category entry and my notification category identifier in the push notification, in order to tell iOS, which notification UI it is supposed to use.

The problem is, when I send the following message to FCM, with the category entry set, FCM erases the entry or changes it to gcm.notification.category, depending where I place the category entry (aps / data, etc.)

This way iOS never shows my custom UI / extension. Unfortunately I was not able to find any help in the FCM documentation.

Send (POST: https://fcm.googleapis.com/fcm/send):

{ 
    "notification": {
        "title": "Good Morning",
        "body": "Wake up Jack!",
        "badge" : 1,
        "sound" : "horn.aiff",
        "category" : "Cheers"     <-- Is going to be deleted / changed
    },

    "data" : {
        "time" : "2018-01-19 23:00:00",
        ...
    },

    "mutable_content" : true,

    "priority" : "high",
    "registration_ids" : [
      "abcdefg123456"
    ]
}

Received:

{
    aps =     {
        alert =         {
            body = "Wake up Jack!";
            title = "Good Morning";
        };
        badge = 1;
        "mutable-content" = 1;
    };

    "gcm.message_id" = "0:1516392279506894%dc84760ddc84760d";
    "gcm.notification.category" = "Cheers";    <-- not working 
}
1
Hi. Could you also post the actual payload you send with FCM? The one that isn't translated to APNs payload yet. - AL.
Hi Al, thanks for your response and the hint, I copied the wrong JSON - it's up to date now :-) - user3191334
Hmm. The category counterpart of the APNS payload for the FCM is click_action (as per the docs). Have you tried it out?\ - AL.
You are the best! Thank you so much! - Feel free to post an answer and I'm happy to accept it! Have a great day! - user3191334
You're welcome. I'll add it in. - AL.

1 Answers

5
votes

The category APNS parameter FCM counterpart is click_action.

When adding in a custom parameter (using the data message payload), it is handled differently for iOS and is often included outside of the aps payload (like in the sample you provided).