Azure / azure-notificationhubs-xamarin

Azure Notification Hubs Sample for Xamarin Forms
MIT License
35 stars 23 forks source link

[BUG] OnPushNotificationReceived not hit at all #59

Open Edwin-Chadio opened 3 years ago

Edwin-Chadio commented 3 years ago

Describe the bug OnPushNotificationReceived not hit at all when push notification arrives. Only OnMessageReceived in the FirebaseMessagingService when app is in foreground. OnMessageReceived also not hit when app is in background.

Code Snippet

           NotificationHub.Start(this.Application, AzureNotificationHubConstants.NotificationHubName, 
            AzureNotificationHubConstants.ListenConnectionString);
            NotificationHub.SetListener(new AzureListener());

public class AzureListener : Java.Lang.Object, INotificationListener
    {
        public void OnPushNotificationReceived(Context context, INotificationMessage message)
        {
            Console.WriteLine($"Message received with title {message.Title} and body {message.Body}");
        }
    }

Expected behavior OnPushNotificationReceived should hit when push notification is delivered

Setup (please complete the following information):

Phenek commented 2 years ago

Actually it will hit when the user click on the notification only.

But I am ok with you when we click on the notification and the app is totaly close/kill. The App start and should raise a NotificationReceived event like in iOS.

But it does not work like iOS and the NotificationReceived event is not raised on click