This is a migrated thread and some comments may be shown as answers.

Push notifications and same device registered multiple times (iOS) - best practices

5 Answers 1041 Views
Push Notifications
This is a migrated thread and some comments may be shown as answers.
This question is locked. New answers and comments are not allowed.
David
Top achievements
Rank 1
David asked on 04 Sep 2015, 04:25 PM

I know​ that this iOS "same device registered multiple times" topic has come up before. I'm trying to determine the best practice to make sure everything works as expected.

I have a iOS test device that is currently registered in Backend Service / Push Notifications / Devices three times (due to multiple installs / uninstalls). They all have the same Push Token, but different Hardware IDs. This behavior makes sense since the Hardware ID on iOS changes with each install, but still seems problematic.

A few questions:

1) When I send a push notification to this device, it "appears" that it only receives the notification once. However, Backend Services states that it was sent to 3 active devices (the number of registrations for that device). Is Backend Services actually sending the notification 3 times to the same Push Token (device)? Or is something else happening?

2) What is the best way to "clean up" these extra duplicate device registrations? Or do I need not too? I would expect that really only one device registration should exist for each device.

Thanks,

David

 

 

5 Answers, 1 is accepted

Sort by
0
Anton Dobrev
Telerik team
answered on 08 Sep 2015, 11:51 AM
Hi David,

As to your questions.

1. Yes, the backend logic will send a separate notification for each device that falls in the notification filter, independent of the fact that they have the same push token.

Usually, you may receive the same notification on the device the same number of times as there are registrations with this token in the backend. However, some times the Apple Push Notification services sends only the last one if the same device is targeted with multiple notifications for a very short interval of time.

In production setting you are rarely expected to stumble upon such case because the user is unlikely to install and reinstall the app a few times within a short time span. If the app has been uninstalled the device will be likely marked as inactive in the backend and no notifications will be sent to it.

On a side note, I believe that you are aware how you can extend the client code (as explained in this forum thread) to persist the Id between installations, if needed at all.

2. At the time of testing you may remove them manually from the portal or from the REST API. In production environment perhaps this will occur rarely if at all.

Let me know if you have questions.

Regards,
Anton Dobrev
Telerik
 
Everlive is now Telerik Backend Services, and is part of the Telerik Platform.
 
0
David
Top achievements
Rank 1
answered on 09 Sep 2015, 11:13 AM

Hi Anton,

Thanks for the great explanations.

With that being said, I decided to try and create my own Id and persist it between installations. Here's what I did.

1) To create and store a unique DeviceId (on both iOS and Android) I utilized the custom plugin UniqueDeviceID

2) Once that was successfully creating an ​Id, I overrode the default Id with this new one by using the _getDeviceId function from the SDK.

currentDevice()._getDeviceId = function () {
    return newuiquedeviceid;
}​

3) That was it. The id persists and as far as I can tell I don't have multiple identical push tokens registered, even after uninstall/reinstall.

 

Thanks,

David

 

0
Anton Dobrev
Telerik team
answered on 11 Sep 2015, 11:51 AM
Hello David,

Thank you for sharing this. Let me know if further questions arise. 

Regards,
Anton Dobrev
Telerik
 
Everlive is now Telerik Backend Services, and is part of the Telerik Platform.
 
0
Thilina Chámin
Top achievements
Rank 1
answered on 09 Jan 2017, 07:07 AM

What if we don't add a new record when a device send a "push token" which is already registered for a user ?

 

0
Anton Dobrev
Telerik team
answered on 10 Jan 2017, 10:51 AM
@Thilina Chámin

Indeed, this also sounds like a viable approach, however, it may be harder to implement and with much code (given that you have to implement a way to determine whether there is a device registered with the same token).

Also, it appears that since iOS 10, the push token may change between app installs/deployments so the impact of this quirk is further minimized.

Regards,
Anton Dobrev
Telerik by Progress
 
Everlive is now Telerik Backend Services, and is part of the Telerik Platform.
 
Tags
Push Notifications
Asked by
David
Top achievements
Rank 1
Answers by
Anton Dobrev
Telerik team
David
Top achievements
Rank 1
Thilina Chámin
Top achievements
Rank 1
Share this question
or