【问题标题】:Apigee PUSH | Exclude notification generator from becoming a notification receiverApigee 推 |排除通知生成者成为通知接收者
【发布时间】:2015-01-10 14:54:16
【问题描述】:

我已让 Apigee Android 推送通知正常工作。但我还有最后一道障碍要跨越。我正在使用 JS SDK 来生成通知。

由于终点是 devices;ql=*/notifications,因此通知正在发送到生成它的设备!

    var options = {
                    method: 'POST',
                    endpoint: 'devices;ql=*/notifications',
                    body: {
                        'payloads': {
                            'notifier': {
                                'message': message,
                                'title': title,
                                'msgcnt': '1'
                            }
                        }
                    }
                };

                client.request(options, function(err, data) {
                    if (err) {
                        //error - POST failed
                    } else {
                        //data will contain raw results from API call
                        //success - POST worked
                    }
                });

如何排除生成通知的设备?

【问题讨论】:

    标签: android notifications apigee


    【解决方案1】:

    您使用的此查询专门获取每台设备。您可以使用 NOT 运算符排除特定设备:

    ?ql=NOT uuid='e15a1924-0c76-11e4-bc79-c76eb28f1666'

    一个问题是我认为您将受限于查询返回的设备数量(默认为 10),因此您需要添加一个 LIMIT 以获取所有设备:

    ?ql=NOT uuid='e15a1924-0c76-11e4-bc79-c76eb28f1666'&limit=1000

    您可以请求的最大值为 1000,因此请记住可能需要分页。

    【讨论】:

    • 不会在api.usergrid.com/org/app/referrals?ql=NOT uuid="66a8c62a-940d-11e4-a427-9deac733b760" 上工作 GET 抛出 org.apache.usergrid.persistence.exceptions.QueryTokenException NoViableAltException
    • 根据您提出请求的方式,您需要转义空格和单引号(我认为这适用于 curl 和 Android SDK): ?ql=NOT%20uuid=% 27a6dbe22a-8ec0-11e3-89da-25a0e8d80900%27 我也在 Postman 中测试过这个语法没有问题。
    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 2017-03-26
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2013-06-14
    • 2018-01-02
    相关资源
    最近更新 更多