Skip to content

Push Notification not showing on "foreground in android #2121

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
ElangoPrince opened this issue May 8, 2019 · 3 comments
Closed

Push Notification not showing on "foreground in android #2121

ElangoPrince opened this issue May 8, 2019 · 3 comments

Comments

@ElangoPrince
Copy link

Hi,
I'm using react-native version( "react": "16.5.2","react-native": "^0.57.8").
Here is my configuration:

              async createNotificationListeners() {
                       const channelId = new firebase.notifications.Android.Channel("Default", "Default", 
                       firebase.notifications.Android.Importance.High);
                       firebase.notifications().android.createChannel(channelId);
                      
                      this.notificationListener = firebase.notifications().onNotification((notification) => {
                      const localNotification = new firebase.notifications.Notification({
                             sound: 'default',
                             show_in_foreground: true,
                     });
                     firebase.notifications().displayNotification(localNotification)
                          .catch(err => console.error(err));
                      });
              }

But still the notification alert can't be shown in foreground.please suggest if any mistake in my code or configuration.

@jacek213
Copy link

jacek213 commented Jun 6, 2019

@ElangoPrince what was the solution?

@lyseiha
Copy link

lyseiha commented Jul 26, 2019

tell us about solution please

@faizantariq1
Copy link

faizantariq1 commented Dec 5, 2019

check your AndroidManifest.xml file.

it should add these:
<service android:name="io.invertase.firebase.messaging.RNFirebaseMessagingService"> <intent-filter> <action android:name="com.google.firebase.MESSAGING_EVENT" /> </intent-filter> </service> <service android:name="io.invertase.firebase.messaging.RNFirebaseInstanceIdService"> <intent-filter> <action android:name="com.google.firebase.INSTANCE_ID_EVENT"/> </intent-filter> </service> <receiver android:name="io.invertase.firebase.notifications.RNFirebaseNotificationReceiver"/> <receiver android:enabled="true" android:exported="true" android:name="io.invertase.firebase.notifications.RNFirebaseNotificationsRebootReceiver"> <intent-filter> <action android:name="android.intent.action.BOOT_COMPLETED"/> <action android:name="android.intent.action.QUICKBOOT_POWERON"/> <action android:name="com.htc.intent.action.QUICKBOOT_POWERON"/> <category android:name="android.intent.category.DEFAULT" /> </intent-filter> </receiver>

and user this answer to create your channel in react native.
#988

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants