Exemple #1
0
        public override void OnMessageReceived(RemoteMessage message)
        {
            RemoteMessage.Notification notification = message.GetNotification();

            // На случай, если сообщение содержит только данные (data message).
            if (notification == null)
            {
                return;
            }

            String title     = notification.Title;
            String text      = notification.Body;
            String channelId = notification.ChannelId;

            NotificationUtilities.DisplayNotification(this, channelId, 0, title, text, message.Data);
        }
        public override void OnReceive(Context context, Intent intent)
        {
            String message = intent.Extras.GetString(IntentNotificationMessageKey);
            String title   = intent.Extras.GetString(IntentNotificationTitleKey);

            String scheduleId = intent.Extras.GetString(IntentNotificationScheduleIdKey);
            String lessonDate = intent.Extras.GetString(IntentNotificationLessonDateKey);
            Dictionary <String, String> data = new Dictionary <String, String>()
            {
                [IntentUtilities.DataUpcomingLessonDateKey]       = lessonDate,
                [IntentUtilities.DataUpcomingLessonScheduleIdKey] = scheduleId
            };

            const Int32 Id        = 777;
            String      channelId = NotificationUtilities.GeneralChannelId;

            NotificationUtilities.DisplayNotification(context, channelId, Id, title, message, data);
        }