asp.web – Firebase Messaging Flutter foreground iOS not working

[ad_1]

It’s actually bizarre, in Android it really works accurately.
I’ve a .Web Core Server it sends a msg by firebase utilizing FirebaseAdmin.Messaging
The way in which to ship it’s one thing like this:

                // Create an inventory containing as much as 500 registration tokens.               
                var message = new MulticastMessage()
                { 
                    Tokens = registrationTokens,                       
                    Knowledge = new Dictionary<string, string>()
                    {
                        { "class_name", request.ClassName.ToLower() },
                        { "motion", request.Motion.ToString() },
                        { "id", request.Id },
                        { "kind", "update_model" },
                        { "all", all.ToString().ToLower() },
                        { "obj", string.IsNullOrEmpty(jsonToSend) ? "" : jsonToSend },
                    },
                };
                await FirebaseMessaging.DefaultInstance.SendMulticastAsync(message);

In flutter I obtain the msg:

FirebaseMessaging.onMessage.hear((RemoteMessage message) {
  generalLog.data('Obtained a message while within the foreground!');
  generalLog.data('Message knowledge: ${message.knowledge}');
});

As you possibly can see I ship the msg with out the param Notification, as a result of I exploit simply to replace some course of in flutter for example fetch an object and replace the native db in flutter for that reason I needn’t present the notification, in Android it really works, however in iOS I by no means see this enter to the tactic FirebaseMessaging.onMessage.hear((RemoteMessage message)…
I understand that if I put the param Notification in C# like this

            var message = new MulticastMessage()
            {
                Tokens = registrationTokens,
                Notification = new Notification
                {
                    Physique = "background course of",
                    Title = "background",
                },
                Knowledge = new Dictionary<string, string> {
                    { "obj", msgToSend},
                    { "kind", "chat" }
                },
            };

The msg will get in iOS, however I do not need this, as a result of in background I obtain a variety of notifications

[ad_2]

Leave a Reply