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

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

cheers,
Mitch

Hi Mitchell,

please refer this documentation part:
https://backendless.com/docs/js/doc.html#example-target-individual-devices
If you will face any problems, let us know here and we’ll be happy to help you.

Regards,
Stan

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?

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

Hi Stan,

Java on server side

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

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

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

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.

Oleg,

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

Thanks

Hello MItchell,
we have checked and this functionality works correctly