0

I am looking at the Parse Push API documentation and have tried it successfully, but is it possible to send multiple push notifications in one network call, for example by sending a JSON array of notifications.

Single notification JSON object as in the official documentation:

{
        "where": {
          "injuryReports": true
        },
        "data": {
          "alert": "Willie Hayes injured by own pop fly."
        }
      } 

I would like to send multiple notifications using an array instead:

[{
        "where": {
          "injuryReports": true
        },
        "data": {
          "alert": "Willie Hayes injured by own pop fly 1."
        }
      },
  {
        "where": {
          "injuryReports": false
        },
        "data": {
          "alert": "Willie Hayes was not injured by own pop fly 2."
        }
      } 
]

An array of notifications does not seem to be supported at this time. I am getting an invalid JSON format error in the response. I was wondering if this is supported, but I am using the wrong JSON structure. If it is not supported, I would request the parse team to support it as it will be very convenient for processing multiple notifications with one API call instead of making a separate network call for each push.

Kara
  • 6,115
  • 16
  • 50
  • 57

1 Answers1

0

I think you can push a JsonArray from parse notifications via bundle.

If your Activity is launched via a push, then the bundle.getIntent().getExtras() will have the JSON in the extra string com.parse.Data.

For more details, please refer to here and here.

Community
  • 1
  • 1
bjiang
  • 6,068
  • 2
  • 22
  • 35
  • Thanks for trying to answer my question. My use case is sending a push from a server through the REST API. I want to be able to send multiple push notifications (with each having its own "data" and "where" query), so that if I have say, 10 notifications to push (which may go to different recipients), I can send them to parse.com using one api/network call instead of 10. Looks like at this time, the "push" resource accepts only notification based on what I have tried. – user3465654 Feb 12 '15 at 00:05
  • I am not very sure if the this is supported, I think you can head to [here](https://parse.com/help) to get some help. – bjiang Feb 12 '15 at 00:29