//Call following function from didFinishLaunchingWithOptions function. And send the response from Your server with 'click_action' key.
{
"to": "Your FCM ID",
"notification": {
"body": "Hello World",
"title": "This is test message.",
"click_action":"snoozeIn.category"
}
}
//MARK:- Set Action Buttons
func setActionCategories(){
let snoozeAction = UNNotificationAction(
identifier: "snooze.action",
title: "Snooze",
options: [.foreground])
let snoozeCategory = UNNotificationCategory(
identifier: "snoozeIn.category",
actions: [snoozeAction],
intentIdentifiers: [],
options: [])
UNUserNotificationCenter.current().setNotificationCategories(
[snoozeCategory])
}
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.