繁体   English   中英

通过Android App向所有人发送Parse Push

[英]Send Parse Push to everyone from Android App

也许有人可以帮助我! 我想从一个简单的android应用程序仅向每个注册的设备发送推送通知。 (对所有人)。 有工作的例子,如何使这与PHP成为可能,但我不知道如何向所有人(没有渠道)发送推送通知给所有人?

到目前为止,我已经找到了此信息,但是它不起作用

我的频道是“”,目标是向所有设备发送推送!

    ParseQuery pushQuery = ParseInstallation.getQuery();
        pushQuery.whereEqualTo("channels", "");


  ParsePush push = new ParsePush();
        push.setQuery(pushQuery); // Set our Installation query
        push.setMessage("Hello world!");
        push.sendInBackground();

我已经像这样更改了我的代码,但是它仍然无法正常工作!

ParsePush.subscribeInBackground("bugatti", new SaveCallback() {
            @Override
            public void done(ParseException e) {
                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);
                }
            }
        });


  ParseQuery pushQuery = ParseInstallation.getQuery();
       pushQuery.whereEqualTo("channels", "bugatti");

   ParsePush push = new ParsePush();
      push.setQuery(pushQuery); 
        push.setChannel("bugatti");
        push.setMessage("Hello world!");
        push.sendInBackground();

如果有人可以帮助我,那就太好了!

您只需要启用“发送通知”。

  1. 前往Parse.com
  2. 前往设置
  3. 去推
  4. 转到“启用客户端推送?”
  5. 设置它。

请享用!

暂无
暂无

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

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