How to send Push Notifications with Parse.com Cloudcode

后端 未结 3 857
暖寄归人
暖寄归人 2021-01-07 05:22

I want to send a Push Notification with Cloudcode on Parse.com.

The push notification should be sent to all android devices that are subscribed to a specific channe

3条回答
  •  离开以前
    2021-01-07 06:16

    All you need is an installation query, along with an accompanying push. For example:

    var pushQuery = new Parse.Query(Parse.Installation);
    pushQuery.containedIn("user", userlist);
    Parse.Push.send({
      where: pushQuery, 
      data: {
         alert: "Your push message here!"
      }
    }, {
      success: function() {
        response.success("pushed");
      }, error: function(error) {
       reponse.error("didn't push");
      }
    });
    

    That installation query can be a query based on a channel, and there are other specifications you can make for the push query, given in the documentation:

    Parse Docs

提交回复
热议问题