CatalystCode / react-native-azurenotificationhub

React Native module to support Azure Notification Hub push notifications on Android, iOS, and Windows.
MIT License
47 stars 75 forks source link

Android Notification not work in foreground #175

Open LimanASL opened 4 years ago

LimanASL commented 4 years ago

Report

Environment

Issues and Steps to Reproduce

Replaces this with steps to repro your issue, if applicable.

Expected Behavior

Describe what you expected would happen.

Actual Behavior

Describe what actually happened. Include screenshots, if applicable.

Link to Code

If you have some code that maintainers can clone/test for themselves, bugs can be resolved much faster. Please paste a link here.

nithinyell commented 4 years ago

+1

LimanASL commented 4 years ago

https://rnfirebase.io/messaging/notifications

Regarding to the document from 'react-native-firebase', if the application is in the foreground, an event will be delivered containing the notification data and no visible notification will be displayed.

In order to display the foreground notification, one of the solutions is use 'react-native-push-notification' to handle the onRemoteNotification function

import PushNotification from 'react-native-push-notification';

onRemoteNotification(notification: any) {
    console.log(notification);

    PushNotification.localNotification({
      message: notification.message,
    });
  }
nithinyell commented 4 years ago

Thanks for the update