Multiple Push Notifications Received

1.4k views Asked by At

I have created an mobile application by using Delphi XE7. The program sends push notifications via Kinvey and GCM. Upon installation of the APK for the first time, it sends one push notification, which is working correctly. For the seconds time(same APP on the same device), it sends twice, and third time, three times and so on. I have discovered the problem is caused by adding more IDs under Kinvey/users. So if I manually delete all the IDs and install the APK again, it will work fine.

Therefore, I would really like to know if the IDs can be cleared by itself upon new installation of APK on the same device.

Thanks in advance!

enter image description here

2

There are 2 answers

4
Agustin Seifert On BEST ANSWER

I had the same problem. AFAIK the answer is no, installing a new APK or uninstalling the application doesnt unregister your ID from your backend provider (Kinvey, Parse, Azure notification hub).

My solution was to add a collapse_key in the gcm payload

Ps: In my case, Notification Hub has an expiration for registrations (I dont know if Kinvey has it too) so the push is received the same time as registrations have BUT collapsed so you just "receive" one until the older registrations expires

0
mjn On

It seems that you are using the TBackendPush component not as it is designed for.

The "Backend" in the component name is a strong indication that the component must be used in a server-side application, which can trigger broadcast messages to all registered devices.

Placing it on the client side could cause unexpected results. Also by including it in the mobile app, you include the Kinvey account credentials in the APK file. The credentials could be extracted by others and then used to send messages from your Kinvey account.

If you need a way to send push notifications, there are two ways - however I don't know if Kinvey supoorts both:

  • send a single HTTP(S) request from the device to your own back-end server, which triggers a broadcast request to Kinvey/GCM
  • send an upstream ("device to cloud") message from the device to your back-end server as described in https://developer.android.com/google/gcm/ccs.html