错误:解析 无法为以查询定位的推送设置渠道。
代码
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();
}
}
});
答案 0 :(得分:0)
您应该使用ParseQuery代替频道进行定位推送。试试这个:
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();
}
});
答案 1 :(得分:0)
除了GrafOrlov的回答,要查询多个频道,你可以使用whereContainsAll方法。像这样:
String[] listOfAnimals = { "cat", "dog" };
ParseQUery pushQuery = ParseInstallation.getQuery();
pushQuery.whereContainsAll("channels", Arrays.asList(listOfAnimals));
ParsePush push = new ParsePush();
push.setQUery(pushQuery);