I am using Firebase push notifications in my app. But when I am sending a notification for some event, I am getting notification\'s multiple times after 2-3 minutes on
Same thing was happening on me , I tried everything only in vain
Then i realised we were storing all fcm tokens of the android device from start till finish without validating or deleting them
I deleted all fcm tokens and re-logged in my app which inserted a fresh singular token in FCM tokens list in my server's db
It worked fine, I think FCM should invalidate earlier tokens before issuing new ones even across installs , multiple apks, and multiple apk debug sessions
Try to send to only 1 token , also clean build and reinstall your app
This started happening to me when I tried to migrate from old GCM to new FCM.
You need to make sure you remove all GCM related code, including gradle (remove com.google.android.gms:play-services-gcm
) and Manifest
(remove:
<uses-permission android:name="mypackage.permission.C2D_MESSAGE" />
<uses-permission android:name="com.google.android.c2dm.permission.RECEIVE" />
<permission
android:name="mypackage.permission.C2D_MESSAGE"
android:protectionLevel="signature" />
)
Also make sure you CLEAN your project and REBUILD it, to remove any cached reference to GCM classes. The last part took me like 2 hours to figure out. A nice trick can be to find-all (⇧⌘F) "GCM" and see if you get hits from the generated files.