Warning: file_get_contents(/data/phpspider/zhask/data//catemap/3/android/224.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Android 解析Can';t设置查询目标推送的通道_Android_Parse Platform_Push Notification - Fatal编程技术网

Android 解析Can';t设置查询目标推送的通道

Android 解析Can';t设置查询目标推送的通道,android,parse-platform,push-notification,Android,Parse Platform,Push Notification,错误:解析无法为查询目标推送设置通道。 代码 ParsePush push = new ParsePush(); push.setChannel(AppConfig.PARSE_CHANNEL); push.setMessage("The Message"); push.sendInBackground(new SendCallback() { @Override public void done(ParseException e)

错误解析无法为查询目标推送设置通道。

代码

    ParsePush push = new ParsePush();
    push.setChannel(AppConfig.PARSE_CHANNEL);
    push.setMessage("The Message");
    push.sendInBackground(new SendCallback() {
        @Override
        public void done(ParseException e) {
            if(e==null)
            {
                Toast.makeText(getApplicationContext(),"success",Toast.LENGTH_SHORT).show();
            }
        }
    });

您应该使用ParseQuery而不是channel来定位推送。试试这个:

    ParseQuery<ParseInstallation> query = ParseInstallation.getQuery();
    query.whereEqualTo("deviceToken", token); // recipient of your push. you can find this token in Installation table of your Parse.com app

    ParsePush push = new ParsePush();
    push.setQuery(query);
    push.setMessage("hi");
    push.sendInBackground(new SendCallback() {
        @Override
        public void done(ParseException e) {
            if (e != null)
                e.printStackTrace();
        }
    });
ParseQuery query=ParseInstallation.getQuery();
查询。whereEqualTo(“deviceToken”,令牌);//你推的接受者。您可以在Parse.com应用程序的安装表中找到此令牌
ParsePush push=新的ParsePush();
setQuery(查询);
推送设置消息(“hi”);
push.sendInBackground(新的SendCallback(){
@凌驾
公共作废完成(Parsee异常){
如果(e!=null)
e、 printStackTrace();
}
});

您应该使用ParseQuery而不是channel来定位推送。试试这个:

    ParseQuery<ParseInstallation> query = ParseInstallation.getQuery();
    query.whereEqualTo("deviceToken", token); // recipient of your push. you can find this token in Installation table of your Parse.com app

    ParsePush push = new ParsePush();
    push.setQuery(query);
    push.setMessage("hi");
    push.sendInBackground(new SendCallback() {
        @Override
        public void done(ParseException e) {
            if (e != null)
                e.printStackTrace();
        }
    });
ParseQuery query=ParseInstallation.getQuery();
查询。whereEqualTo(“deviceToken”,令牌);//你推的接受者。您可以在Parse.com应用程序的安装表中找到此令牌
ParsePush push=新的ParsePush();
setQuery(查询);
推送设置消息(“hi”);
push.sendInBackground(新的SendCallback(){
@凌驾
公共作废完成(Parsee异常){
如果(e!=null)
e、 printStackTrace();
}
});

除了GrafOrlov answer,要查询多个频道,您可以使用whereContainsAll方法。像这样:

String[] listOfAnimals = { "cat", "dog" };
ParseQUery pushQuery = ParseInstallation.getQuery();
pushQuery.whereContainsAll("channels", Arrays.asList(listOfAnimals));

ParsePush push = new ParsePush();
push.setQUery(pushQuery);

除GrafOrlov answer外,要查询多个频道,您还可以使用whereContainsAll方法。像这样:

String[] listOfAnimals = { "cat", "dog" };
ParseQUery pushQuery = ParseInstallation.getQuery();
pushQuery.whereContainsAll("channels", Arrays.asList(listOfAnimals));

ParsePush push = new ParsePush();
push.setQUery(pushQuery);

你找到解决办法了吗?你找到解决办法了吗?这对我很有效,谢谢。如何使用查询中存档的频道。我尝试了以下代码查询;这对我不起作用。我认为它的becuase Channels字段在ParseInstallation对象中定义为Array。你能帮我如何使用频道上的where条件吗?这对我很有用,谢谢。如何使用查询中存档的频道。我尝试了以下代码查询;这对我不起作用。我认为它的becuase Channels字段在ParseInstallation对象中定义为Array。你能帮我如何使用频道的where条件吗。