durmusalicollu avatar image
durmusalicollu asked

What is the Best practice to push notification in a segment of user group?

Hi all,

I have a few questions.

First one is, I am trying to send push notification to same time in same area users. To do that I have created segments and running Scheduled Tasks to run cloud script to Run actions on each player in a segment. Is this over use cpu limit? Because in task result it shows it run successfully but also in Automation side I can see there was an error in Errors.

Second question is, some devices are able to register with different NotificationEndpointARN. This happens because I let users to choice different login types. Device Id, Facebook. But for all those actions, I am using same function to register push notification. (Adding it below) The part which I don't understand is how same device can get different DeviceToken? Also second part of this problem is how can I prevent sending 2 push notification to same device?

    public void RegisterIOSDevice()


        byte[] token = UnityEngine.iOS.NotificationServices.deviceToken;

        if (token != null)


            RegisterForIOSPushNotificationRequest request = new RegisterForIOSPushNotificationRequest();

            request.DeviceToken = System.BitConverter.ToString(token).Replace("-", "").ToLower();



                (RegisterForIOSPushNotificationResult result) =>


                    Debug.Log("Push Registration Successful");

                }, OnPlayFabError);




            Debug.Log("Push Token was null!");


Push Notifications
10 |1200

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.

1 Answer

brendan avatar image
brendan answered

What are the details of the errors? If you want to send a Push Notification to a Segment of users, then yes, you can use a Scheduled Task to do so. The Task iterates over every player in the Segment and takes the specified action. But to be clear, the Push Notifications do not go out to all player simultaneously, as the list of users could be in the millions. The Task processes the list, taking the action for each. So depending on the size of the Segment, it may take some time to complete.

But I'm not clear on your scenario for the second case. It sounds like you're saying that you have cases where you have a single client device that you've created multiple accounts with, and that you register each for Push Notification. If so, then yes, it's entirely possible that you'd get the Push twice, if both accounts are in the Segment for your Scheduled Task. The reason two completely different player accounts would have different Push device tokens is because they're different accounts, and so are registered separately.

10 |1200

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.

durmusalicollu avatar image durmusalicollu commented ·

I can see the error in the push service error side but I don't know the details. I don't even know where to check for details.

For the second case, how can I remove this duplicated devices? This happens when someone register with device Id and other with the facebook. For the facebook call, there is no device Id section, so that I can’t check at first is this device registered before or not.

On the other hand, is it possible to remove push Id with any API? Or check is there any duplicate push sender Id?

0 Likes 0 ·
brendan avatar image brendan durmusalicollu commented ·

For the duplicate accounts, I'm not clear on how you're getting in that state. The normal path is, sign in with Device ID first. That creates a "guest" account if the player doesn't have one. Then, incentivize the user to add a recoverable account (like Facebook) later, for which you'd use the Link... API call. If you follow that best practice, it's not possible to have two separate accounts for the user from one device.

But if you do, there's literally no way we can prevent the Push from going to the user twice. The registrations have different signatures, and since the player accounts are also distinct, we have no way of knowing that it's the same device - or even the same person.

For the error, can you try making the call via Postman and send us the error you get?

0 Likes 0 ·

Write an Answer

Hint: Notify or tag a user in this post by typing @username.

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.