认购时,Android的解析推送通知连收 [英] Android Parse push notifications not received even when subscribed

查看:272
本文介绍了认购时,Android的解析推送通知连收的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我见过<一个href=\"http://stackoverflow.com/questions/28518803/android-parse-push-notification-not-working-in-android\">this问题,虽然我的问题似乎相似,我把一切都设置正确,这里的相关的Java:

I have seen this question, and although my problem seems similar, I have everything set up properly, here's the relevant java:

    Parse.initialize(this, "MY_KEY", "MY_KEY");
    ParseInstallation.getCurrentInstallation().saveInBackground();

    ParsePush.subscribeInBackground("", new SaveCallback() {
        @Override
        public void done(ParseException e) {

            // callback to confirm subscription

            if (e == null) {
                Log.d("com.parse.push", "successfully subscribed to the broadcast channel.");
            } else {
                Log.e("com.parse.push", "failed to subscribe for push", e);
            }
        }
    });

不管怎么说,看着我的parse.com认购仪表盘得到了肯定,当我尝试把它说推送2台设备(我的电话和虚拟机)。然后,它显示了发送推,但在名单上的一个绿色的对勾推压送它说0。

Anyways, looking at my dashboard on parse.com the subscription is being recognized and when I attempt to send the push it says "sending to 2 devices" (my phone and a virtual machine). It then shows up with a green check mark on the list of sent pushes BUT under "pushes sent" it says 0.

这似乎也有时,deviceToken和pushType没有被正确设置,但一直没有生效,这些无论是present都没有任何区别,但我假设他们是必要的。

It also seems that sometimes, deviceToken and pushType are not being set properly, but there hasn't been any difference in effect whether these are present are not, although I'm assuming they are necessary.

如何发送任何推到订阅设备成功?

How is not sending any pushes to subscribed devices a success?

我的清单可以发现这里

推荐答案

考虑到所有的XML清单是正确的,试试这个:

Considering that all the XML manifest is correct, try this:

> Parse.initialize(this, "MY_KEY", "MY_KEY");
> ParseAnalytics.trackAppOpenedInBackground(getIntent());       
> ParsePush.subscribeInBackground("");//Optionaly put your callback
> PushService.startServiceIfRequired(getApplicationContext());
>  
> ParseInstallation.getCurrentInstallation().saveInBackground();

这篇关于认购时,Android的解析推送通知连收的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆