Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

iOS and Google Firebase - How to do Notification Actions

My Goal: Using Google Firebase Messaging, set up iOS Notification Actions

Resources Referenced:

  • Action Notification Tutorial
  • FCM - Message Format
  • FCM - Message Format with Data
  • FCM - Handling Messages on iOS
  • iOS - Remote Notification Payload

Question:

I've looked through the above resources, but I still can't figure out how to set the category key for iOS, enabling notification actions. How do I do this?

like image 467
smileham Avatar asked Aug 22 '16 23:08

smileham


People also ask

Does Firebase notification work on iOS?

For Apple client apps, you can receive notification and data payloads up to 4000 bytes over the Firebase Cloud Messaging APNs interface. To write your client code in Objective-C or Swift, we recommend that you use the FIRMessaging API. The quickstart example provides sample code for both languages.

How do I use Firebase to send notifications?

For sending FCM notification payload you can use Firebase Cloud Messaging Tool in firebase console. And click on Send your first message. Then enter the Title and body field. If you wish to send it to a particular device then click on Send test message and enter the FCM registration token.

How do I send push notifications to iOS?

First, you enable push notifications in the Xcode project. Select your project in the project navigator and click on the Capabilities tab. Enable push notifications by turning the switch ON. APNs will respond with a device token identifying your app instance.


1 Answers

Figured it out as I was writing the question, and a Google search didn't help me, so hopefully this will help someone else.

I found the answer in this document: FCM HTTP Protocol

In the "Notification payload support" section, the parameter click_action says it "Indicates the action associated with a user click on the notification. Corresponds to category in the APNs payload."

So click_action == aps.category

like image 158
smileham Avatar answered Sep 18 '22 23:09

smileham