How to send Push Notifications with Parse.com Cloudcode

后端 未结 3 881
暖寄归人
暖寄归人 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:07

    1) Add

    Parse.initialize("APPLICATION_ID", "JAVASCRIPT_KEY");
    

    2) Enable Java scripts push notification in Parse.com

    3) Download Java script project "parse-js-blank"

    4) Create installation object with Channel

    5) send request.

    Parse.Push.send({
              channels: [ "Giants","Vaquar" ],
              data: {
                alert: "Vaquar Alert Message."
              }
            }, {
              success: function() {
                // Push was successful
              },
              error: function(error) {
                // Handle error
                alert("(error"+eval(error));
              }
            });
    

    Reference: https://parse.com/docs/js/guide#push-notifications

提交回复
热议问题