I use Firebase in my chat application. but when I send one message, I get one notification. this is normal. But after 2-3 minutes I will start to receive all the old notifications one by one. here is my code to receive. I delete all the code to handle notifications, but after that I still got the notification again: -
public class FirebaseNotificationReceiver extends WakefulBroadcastReceiver { private final String NOTIFICATION_BODY_KEY = "gcm.notification.body"; @Override public void onReceive(Context context, Intent intent) { Log.e("NOTIFICATION RECEIVED", "RECEIVED"); }
in manifest:
<receiver android:name=".firebase.FirebaseNotificationReceiver" android:exported="true" android:permission="com.google.android.c2dm.permission.SEND"> <intent-filter> <action android:name="com.google.android.c2dm.intent.RECEIVE" /> </intent-filter> </receiver>
source share