简体   繁体   English

Parse.com Android-禁用推送通知

[英]Parse.com android - disable push notifications

I've started using parse.com to receive push notifications in my application. 我已经开始使用parse.com在我的应用程序中接收推送通知。

It works perfectly, but I have a couple of questions. 它运行完美,但是我有几个问题。

We perform registration, but unused channels, as follows: 我们执行注册,但未使用的渠道如下:

  ParsePush.subscribeInBackground("", new SaveCallback() {
            @Override
            public void done(ParseException e) {
                if (e == null) {
                    Log.d("dmode", "Oks!");
                } else {
                    Log.e("dmode", "Fail :(", e);
                }
            }
        });

My first question is: 我的第一个问题是:

I find no way to disable receiving push notifications I searched the official documentation and stackoverflow, but I find solutions that do not work for me. 我没有找到禁用接收推送通知的方法,我搜索了官方文档和stackoverflow,但是发现对我不起作用的解决方案。 I tried: 我试过了:

ParsePush.unsubscribeInBackground("", new SaveCallback() {
    @Override
    public void done(ParseException e) {
        if (e == null) {
            Log.d("dmode", "unsuscribe oks");
        } else {
            Log.e("dmode", "unsuscribe fail", e);
        }
    }
});

Unsuccessfully, I have also tried: 未成功,我也尝试过:

ParsePush.unsubscribeInBackground("");

...but not work. ...但是行不通。

I'm not using channels, that is why the quotes are empty: 我没有使用渠道,这就是引号为空的原因:

ParsePush.subscribeInBackground("", new SaveCallback() { //...

How I can enable and disable push notifications? 如何启用和禁用推送通知?

The second query is that sometimes receive duplicate notifications until two three times at once on the same device. 第二个查询是有时在同一设备上一次收到两次重复通知,直到两次两次。 Someone has been the same? 有人一直一样吗?

Thank you very much for the help. 非常感谢你的帮助。

Greetings! 问候!

I think you should use a name for a default channel even if you are not using channels and not the empty string "". 我认为您应该为默认频道使用一个名称,即使您没有使用频道也不是空字符串“”。 Also have a look here Parse Question 在这里也看看解析问题

I quote from the answer on the above link 我引用以上链接的答案

If you called PushService.setDefaultCallback, call it again passing null as the class. 如果您调用了PushService.setDefaultCallback,则通过将null作为类再次调用它。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM