解析 - 无法从设备发送推送通知

时间:2014-11-11 03:03:47

标签: android notifications parse-platform push send

您好我正在尝试从设备向另一个设备发送推送通知。

这是我的代码:

public void onClick(View v) {
            // TODO Auto-generated method stub
            ParseQuery pushQuery = ParseInstallation.getQuery();
            pushQuery.whereEqualTo("gender", "male");

            ParsePush pushMsg = new ParsePush();
            pushMsg.setQuery(pushQuery);
            pushMsg.setMessage("Hey Male!");
            pushMsg.sendInBackground(new SendCallback() {

                @Override
                public void done(ParseException e) {
                    // TODO Auto-generated method stub
                    if(e!=null)
                        e.printStackTrace();
                    else
                        Log.i("Send push", "Success");
                }
            });
        }

问题是,当我尝试发送通知时,日志显示“成功”,但我的设备中没有收到任何内容。 当我在仪表板上放置相同的参数时,它可以完美地工作。 关于这个问题请指导我。

1 个答案:

答案 0 :(得分:0)

您的第二台设备未注册或未注册,或者您未设置为“性别”=“男性”,此处为  如何注册here

如何登录here

登录后如何设置“gender”=“male”:

ParseUser u= ParseUser.getCurrentUser() ;
        u.put("location", point);
 u.saveInBackground();

还设置Title to push

    ParsePush pushMsg = new ParsePush();
            pushMsg.setQuery(pushQuery);
  pushMsg.settitle("title");
            pushMsg.setMessage("Hey Male!");
pushMsg.sendInBackground();
相关问题