无法通过Azure服务获取通知

时间:2015-01-29 18:13:02

标签: javascript asp.net azure notifications push

我有一个phonegap ios应用程序,我正在尝试设置推送通知。我不是程序员,所以请耐心等待。我在Microsoft azure的网站上做了一切并生成了这个脚本:

function insert(item, user, request) {
    request.execute();
    // Set timeout to delay the notification, to provide time for the
    // app to be closed on the device to demonstrate push notifications
    setTimeout(function() {
        push.apns.send(null, {
            alert: "Alert: " + item.text,
            payload: {
            inAppMessage: "Update: '" + item.text + "'"
            }
        });
    }, 2500);
}

我的问题很简单。我该怎么处理这个脚本?我已经设置了一个asp.net表单来更新数据库,但是当我添加任何数据时没有任何反应。

1 个答案:

答案 0 :(得分:0)

您已经显示的脚本是由Azure移动服务,JS支持的服务(节点js)生成的。因此,Azure Mobile服务代码(您已发布)表示,对于每个数据库插入/更新/删除将执行以下脚本 - 您需要弄清楚从哪里获取它。以下是我的设置中的示例(对我来说,它是对{DB}的insert操作)

enter image description here

这意味着,它将执行插入数据库请求,然后它将使用push.apns.send向Apple发送通知。

假设:对于您的情况,脚本对应于insert操作。

因此,要使其工作,您需要调用Azure移动服务,以便特别执行此脚本并发送通知。

如果您使用Asp.net表单直接插入数据库,则不会执行此脚本,也不会发送通知。