javascript - 在 Parse 中使用 javaScript 发送推送通知

标签 javascript android jquery-mobile parse-platform push-notification

实际上,我们已经完成了从移动设备向移动设备发送推送通知以及使用解析查询向移动设备解析的过程。现在我们正在尝试使用 Javascript 将推送通知从 Web 应用程序发送到移动设备。

 function authentication() {

  Parse.$ = jQuery;

  // Initialize Parse with your Parse application javascript keys
  Parse.initialize("app key",
                   "javascript key");

    Parse.Push.send({
          //where: pushQuery,
          channels: [ "Demo","Done" ],
          data: {
          alert : "Hello word" 
    }}, { success: function() {
          // Push was successful 
          alert : "Push was successful"
        //  debugger;
        },
          error: function(error) {


        }}).then (function(error) {
          //Marks this promise as fulfilled, 
          //firing any callbacks waiting on it.


        });


}

请指导我们,我们是 javascript 的新手。 我们收到这样的错误

POST https://api.parse.com/1/push 400 (Bad Request)

最佳答案

您是否在 Parse 应用的推送通知设置中激活了启用客户端推送

However, if you decide to send notifications from the JavaScript SDK outside of Cloud Code or any of the other client SDKs, you will need to set Client Push Enabled in the Push Notifications settings of your Parse app.

发件人:https://parse.com/docs/js/guide#push-notifications-sending-pushes

请注意,您不应从任何客户端发送通知,而应从云代码触发通知

However, be sure you understand that enabling Client Push can lead to a security vulnerability in your app, as outlined on our blog. We recommend that you enable Client Push for testing purposes only, and move your push notification logic into Cloud Code when your app is ready to go into production.

关于javascript - 在 Parse 中使用 javaScript 发送推送通知,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/30069183/

相关文章:

android - Google Places API 不会通过 Android 中的照片引用返回照片

listview - jQuery Mobile 中的可排序 ListView

javascript - 动态创建的弹出窗口无法与 jQuery 绑定(bind)

javascript - 了解 jquery 选择器的新关键字关联

android - Google Glass 应用程序演示的屏幕和音频转换

javascript - 如何更轻松地将 += 与 jQuery 选择器一起使用?

android - Tensorflow 图像分类 Android 示例无法构建

javascript - 无法在 jQuery Mobile 中更改样式

javascript - jQuery 不在 IE 浏览器中同时使用 jquery-ui-1.10.3.custom.js 和 jquery-ui-1.9.2.custom.js

javascript - 变量赋值中操作数的说明