Support Topics Documentation Slack YouTube Blog

Push notification: target array of deviceIDs in a single API call

(MItchell) #1

Hi team,

I want to target a list of devices for a push notification, send via server code. When I implement deliveryOptions.addPushSinglecast( ArrayOfDeviceIDs );
the push notification is only sent to the first entry in the array, is it possible to target all those devices in a single call?

As a work around I loop through the array and send the push notification every time for each individual deviceID


(Stanislaw Grin) #2

Hi Mitchell,

please refer this documentation part:
If you will face any problems, let us know here and we’ll be happy to help you.


(MItchell) #3

Hi Stan,

Yes I have followed the example already. As you can see I call addPushSinglecast with array of device IDs as the argument.

As I explained, It only sends to the first entry of the array, not all.

So is it supposed to send it to all device IDs in the array or not?

(Stanislaw Grin) #4

Just to clarify, you are using NodeJS or Java on server-side?

(MItchell) #5

Hi Stan,

Java on server side

(MItchell) #6

I tried with an array with two entries, both the same device ID. Is that the problem? Do they have to be unique values?

(Stanislaw Grin) #7

Seems there’s an error in documentation, please try setPushSinglecast method instead of addPushSinglecast

(MItchell) #8

I tried deliveryOptions.setPushSinglecast( deviceIDArray); and also printed the contents of deviceIDArray which returned [2A77247C-BAE3-406D-A0E1-AD9E393F831B, 2A77247C-BAE3-406D-A0E1-AD9E393F831B]

However I am still receiving only one notification

(Oleg Vyalyh) #9

Hi, Mitchell.
The array setPushSinglecast is used to send messages to a set of device. For one-time sending.
And there is no sense to put two identical deviceId, because they point to the same device.
I’ve tried now with two devices and all works.
Could you describe more precisely what do want to achieve? Or post here small code snippet that reproduce the problem that you have faced with.

(MItchell) #10


The reason I use the same device ID twice is because I only have one physical iOS device to test receiving of notifications.

I wanted to test if array of device IDs would work in this method.

If you say it is working then I will implement it and get feedback from users


(Sergey Kukurudzyak) #11

Hello MItchell,
we have checked and this functionality works correctly