Skip to content

Commit 1257d53

Browse files
feat(messaging): android.tag property on Notification (#5452)
1 parent 07f33d1 commit 1257d53

File tree

3 files changed

+9
-1
lines changed

3 files changed

+9
-1
lines changed

packages/firebase_messaging/firebase_messaging/android/src/main/java/io/flutter/plugins/firebase/messaging/FlutterFirebaseMessagingUtils.java

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -149,6 +149,10 @@ private static Map<String, Object> remoteMessageNotificationToMap(
149149
androidNotificationMap.put("visibility", notification.getVisibility());
150150
}
151151

152+
if (notification.getTag() != null) {
153+
androidNotificationMap.put("tag", notification.getTag());
154+
}
155+
152156
notificationMap.put("android", androidNotificationMap);
153157
return notificationMap;
154158
}

packages/firebase_messaging/firebase_messaging/example/lib/main.dart

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -127,7 +127,6 @@ class _Application extends State<Application> {
127127
FirebaseMessaging.onMessage.listen((RemoteMessage message) {
128128
RemoteNotification notification = message.notification;
129129
AndroidNotification android = message.notification?.android;
130-
131130
if (notification != null && android != null) {
132131
flutterLocalNotificationsPlugin.show(
133132
notification.hashCode,

packages/firebase_messaging/firebase_messaging_platform_interface/lib/src/remote_notification.dart

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -39,6 +39,7 @@ class RemoteNotification {
3939
smallIcon: map['android']['smallIcon'],
4040
sound: map['android']['sound'],
4141
ticker: map['android']['ticker'],
42+
tag: map['android']['tag'],
4243
visibility: convertToAndroidNotificationVisibility(
4344
map['android']['visibility']),
4445
);
@@ -112,6 +113,7 @@ class AndroidNotification {
112113
this.smallIcon,
113114
this.sound,
114115
this.ticker,
116+
this.tag,
115117
this.visibility = AndroidNotificationVisibility.private});
116118

117119
/// The channel the notification is delivered on.
@@ -153,6 +155,9 @@ class AndroidNotification {
153155

154156
/// The visibility level of the notification.
155157
final AndroidNotificationVisibility visibility;
158+
159+
/// The tag of the notification.
160+
final String? tag;
156161
}
157162

158163
/// Apple specific properties of a [RemoteNotification].

0 commit comments

Comments
 (0)