노티플라이 Flutter SDK에서는 푸시 알림 클릭 이벤트를 구독하여 유저가 푸시 알림을 클릭했을 때 앱 내에서 특정 동작을 수행하도록 커스터마이즈 할 수 있습니다. 아래 예시는 Go Router 라이브러리를 사용하여 푸시 알림 클릭 이벤트를 구독하고, 푸시 알림 클릭 시 특정 페이지로 이동하는 예시입니다.
INotificationClick 의 notification 객체에 접근하여, 유저가 어떠한 푸시를 클릭했는지에 대한 정보를 확인할 수 있습니다.아래는 INotification 객체의 속성들에 대한 설명입니다.
표시 INotification Properties
Int
Android system-level 푸시 알림 ID입니다. (Since 1.5.0)
String?
푸시 알림이 발송된 노티플라이 캠페인의 ID입니다. (Since 1.5.0)
String?
푸시 메시지의 내용입니다. (Since 1.5.0)
String
푸시 메시지의 제목입니다. (Since 1.5.0)
String
푸시 메시지가 클릭되었을 때 이동할 URL입니다. 만약 ‘앱 실행’ 액션으로 푸시 알림을 발송하였다면, null 값이 반환됩니다. (Since 1.5.0)
HashMap<String, String>
FCM 푸시 메시지의 data 필드에 포함된 키-값 쌍의 커스텀 데이터입니다. 노티플라이 콘솔에서 설정할 수 있습니다. (Since 1.5.0)
String?
이미지형 푸시 메시지에 포함된 이미지 URL 입니다. (Since 1.5.0)
Importance
Importance 는 tech.notifly.push.impl.Importance 에 정의되어 있으며, Importance.HIGH, Importance.NORMAL, Importance.LOW 중 하나의 값입니다. (Since 1.5.0)
String?
노티플라이 서버에서 임의로 생성한 메시지 ID입니다. (Since 1.5.0)
String
FCM data의 가공되지 않은 payload입니다. JSON을 stringify한 형태로 반환됩니다. (Since 1.5.0)
Long
FCM 서버에서 푸시 알림을 발송한 시간입니다. (Since 1.5.0)
Int
푸시 알림의 TTL(Time To Live) 값입니다. (Since 1.5.0)
OSNotificationClickEvent의 notification 멤버에 접근하여, 유저가 클릭한 푸시에 대한 정보를 확인할 수 있습니다.
/// Callback for handling received notifications.typedef NotificationClickListener = void Function(OSNotificationClickEvent event,);/// Represents a notification received from the Notifly service.enum OSNotificationImportance {/// The notification is of low importance.low,/// The notification is of normal importance.normal,/// The notification is of high importance.high,}/// Represents a notification received from the Notifly service.class OSNotification extends JSONStringRepresentable {/// The Notifly message ID of the notification.String? notiflyMessageId;/// (Only Android) The Android system notification ID of the notification.int? androidNotificationId;/// Notifly campaign ID where the notification was sent from.String? campaignId;/// Notification titleString? title;/// Notification bodyString? body;/// (Only Android) Importance of the notification.OSNotificationImportance? importance;/// URL included in the notification.String? url;/// URL to the image included in the notification.String? imageUrl;/// Sent time of the notification in milliseconds since epochint? sentTime;/// TTL of the notification in secondsint? ttl;/// Customized data included in the notification.Map<String, dynamic>? customData;/// Raw payload of the notification.Map<String, dynamic>? rawPayload;}/// Represents a notification click event.class OSNotificationClickEvent {OSNotification notification;}
아래는 OSNotification 객체의 속성들에 대한 설명입니다.
표시 OSNotification Properties
int?
Android system-level 푸시 알림 ID입니다. (Since 1.4.0)
String?
푸시 알림이 발송된 노티플라이 캠페인의 ID입니다. (Since 1.4.0)
String?
푸시 메시지의 내용입니다. (Since 1.4.0)
String?
푸시 메시지의 제목입니다. (Since 1.4.0)
String?
푸시 메시지가 클릭되었을 때 이동할 URL입니다. 만약 ‘앱 실행’ 액션으로 푸시 알림을 발송하였다면, null 값이 반환됩니다. (Since 1.4.0)
Map<String, dynamic>?
FCM 푸시 메시지의 data 필드에 포함된 키-값 쌍의 커스텀 데이터입니다. 노티플라이 콘솔에서 설정할 수 있습니다. (Since 1.4.0)
String?
이미지형 푸시 메시지에 포함된 이미지 URL 입니다. (Since 1.4.0)
Importance
Importance.high, Importance.normal, Importance.low 중 하나의 값입니다. (Since 1.4.0)
String?
노티플라이 서버에서 임의로 생성한 메시지 ID입니다. (Since 1.4.0)
Map<String, dynamic>?
FCM data의 가공되지 않은 payload입니다. JSON을 stringify한 형태로 반환됩니다. (Since 1.4.0)
int?
FCM 서버에서 푸시 알림을 발송한 시간입니다. (Since 1.4.0)
int?
푸시 알림의 TTL(Time To Live) 값입니다. (Since 1.4.0)
OSNotificationClickEvent의 notification 멤버에 접근하여, 유저가 클릭한 푸시 알림의 정보를 확인할 수 있습니다.