0

I have an android application that uses FCM to get notifications. I'm using this versions:

implementation "com.google.firebase:firebase-analytics-ktx:17.4.3"
implementation "com.google.firebase:firebase-inappmessaging-display-ktx:19.0.7"
implementation "com.google.firebase:firebase-messaging:20.2.0"

The problem that I've encountered recently is that I tried to send push notification with my own backend server via REST API call. I noticed that for every single api call, android devices get notifications twice.

So I've checked this Question: Firebase send push notification twice and I noticed that like Tom Bevelander's answer, I have a third party lib that uses GCM behind and when I removed that lib from project, problem fixed.

So I have to force my users to update the application. but I don't really want this approach. Something that I saw is that on previous version (GCM included app) when I'm testing push notification with Firebase Panel itself, everything works fine and devices get single notification. but with api call, devices get duplicate notifs. What is the difference between this approaches? How can I find out whats happening behind the FirebasePanel? So that I call same api that panel uses itself? The endpoints that I've tested is this:

https://fcm.googleapis.com/fcm/send

and this:

https://fcm.googleapis.com/v1/projects/myproject-b5ae1/messages:send
Saman Sattari
  • 3,322
  • 6
  • 30
  • 46

1 Answers1

0

brother may shore the device token is maybe duplicate like two users sign in from the same device and both user device token is same and server through a notification on the base of device token .so it throughs notification twice if he found the same token twice or more.

AHSSAN
  • 59
  • 4
  • I said that the problem is because of GCM inside a third party library. and when i removed that lib, problem fixed. Thats not my problem. I want to know that why sending notif from panel is different from sending it via rest api – Saman Sattari Sep 16 '20 at 17:12