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

4 posts, 0 answers
  1. David
    David avatar
    30 posts
    Member since:
    Sep 2010

    Posted 04 Sep 2015 Link to this post

    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

     

     

  2. Anton Dobrev
    Admin
    Anton Dobrev avatar
    539 posts

    Posted 08 Sep 2015 Link to this post

    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.
     
  3. David
    David avatar
    30 posts
    Member since:
    Sep 2010

    Posted 09 Sep 2015 in reply to Anton Dobrev Link to this post

    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

     

  4. Anton Dobrev
    Admin
    Anton Dobrev avatar
    539 posts

    Posted 11 Sep 2015 Link to this post

    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.
     
Back to Top