Skip to content
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

firebase push notification popup doesn't show in foreground. #11

Open
ravi123saxena opened this issue May 11, 2021 · 0 comments
Open

firebase push notification popup doesn't show in foreground. #11

ravi123saxena opened this issue May 11, 2021 · 0 comments

Comments

@ravi123saxena
Copy link



<meta-data android:name="com.dieam.reactnativepushnotification.notification_foreground"

    android:value="false"/>

    <!-- Change the resource name to your App's accent color - or any other color you want -->

    <meta-data android:name="com.dieam.reactnativepushnotification.notification_color"

    android:resource="@color/white"/> <!-- or @android:color/{name} to use a standard color -->

    <receiver android:name="com.dieam.reactnativepushnotification.modules.RNPushNotificationActions" />

    <receiver android:name="com.dieam.reactnativepushnotification.modules.RNPushNotificationPublisher" />

    <receiver android:name="com.dieam.reactnativepushnotification.modules.RNPushNotificationBootEventReceiver">

      <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"/>

      </intent-filter>
    </receiver>
    <service
      android:name="com.dieam.reactnativepushnotification.modules.RNPushNotificationListenerService"
      android:exported="false" >
      <intent-filter>
      <action android:name="com.google.firebase.MESSAGING_EVENT" />
      </intent-filter>
    </service>

code:

class App extends React.Component {
constructor(props) {
super(props);
console.reportErrorsAsExceptions = false;
this.notif = new NotifService(
this.onRegister.bind(this),
this.onNotif.bind(this),
);
this.state = {
appState: AppState.currentState,
notifyState:0,
};
}

onRegister = async (token) => {
await AsyncStorage.setItem('fcmToken', token);
}

onNotif(notif) {
//Alert.alert(notif.title, notif.message);
PushNotification.localNotification({
title: notif.title,
message: notif.message,
playSound: true,
soundName: 'default',
actions: '["Yes", "No"]'
});
}

handlePerm(perms) {
Alert.alert('Permissions', JSON.stringify(perms));
}

Please help asap. Thanks for your support.

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

1 participant