TobiasBuchholz / Plugin.Firebase

Wrapper around the native Android and iOS Firebase Xamarin SDKs
MIT License
211 stars 49 forks source link

Overriding the default PushNotification From Firebase CloudMessaging #173

Closed samirgcofficial closed 1 year ago

samirgcofficial commented 1 year ago

I can override the push notification when app is in running mode with my custom notification. But when the app is in background or killed i am getting the default notification from the firebase cloud messaging.
[Service(Exported = true)] [IntentFilter(new[] { "com.google.firebase.MESSAGING_EVENT" })] public class AsdFirebaseMessagingService : FirebaseMessagingService { private const int NotificationId = 0;

        public override void OnMessageReceived(RemoteMessage remoteMessage)
        {
            base.OnMessageReceived(remoteMessage);
            Console.WriteLine("Message Received");
            if (remoteMessage.Data.TryGetValue("title", out var title) &&
                remoteMessage.Data.TryGetValue("body", out var body))
            {
                ShowNotification(title, body);
            }
        }
    }