Java 推送通知的问题
我遇到了解析推送通知的问题,我正在尝试实现用户对用户的推送通知,在后端它确实显示消息已发送,但实际上消息没有显示给用户 此外,消息似乎被发送到查询中的所有用户,在查询中只应发送给匹配的用户 下面是处理推送通知的代码部分Java 推送通知的问题,java,android,android-fragments,push-notification,parse-platform,Java,Android,Android Fragments,Push Notification,Parse Platform,我遇到了解析推送通知的问题,我正在尝试实现用户对用户的推送通知,在后端它确实显示消息已发送,但实际上消息没有显示给用户 此外,消息似乎被发送到查询中的所有用户,在查询中只应发送给匹配的用户 下面是处理推送通知的代码部分 query1.findInBackground(new FindCallback<ParseUser>() { @Override public void done(List<ParseUser> obje
query1.findInBackground(new FindCallback<ParseUser>() {
@Override
public void done(List<ParseUser> objects,ParseException e) {
if (e == null) {
for(int i=0;i<objects.size();i++){
// Do whatever you need to extract object from "users"
ParseQuery<ParseObject> query1 = ParseQuery.getQuery("User");
query1.whereNotEqualTo("objectId", ParseUser.getCurrentUser()
.getObjectId());
query1.setLimit(1);
query1.whereGreaterThanOrEqualTo("UserAge", minimumAge);
query1.whereLessThanOrEqualTo("UserAge", maximumAge);
Button buttonconfirm = (Button) getView().findViewById(R.id.btnMatchConfirm);
buttonconfirm.setText("Confirm");
mUserNameRetrieved = (TextView) getActivity().findViewById(R.id.userlistname);
mUserNameRetrieved.setText(objects.get(i).get("Name").toString());
Button newPage = (Button)getView().findViewById(R.id.btnMatchConfirm);
newPage.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
// ParseUser currentUser = ParseUser.getCurrentUser();
// currentUser.put("UserMatchName", mUserRetrieved);
Intent intent = new Intent(getActivity(), matchOptionActivity.class);
startActivity(intent);
sendPushNotifications();
}
private void sendPushNotifications() {
ParseQuery<ParseInstallation> query = ParseInstallation.getQuery();
//send push notification
ParsePush push = new ParsePush();
push.setQuery(query);
push.setMessage(getActivity()
.getString(R.string.push_match_request_message, ParseUser.getCurrentUser().getObjectId()));
push.sendInBackground();
}
});
}
} else if (e != null) {
}
}
});
query1.findInBackground(新的FindCallback(){
@凌驾
公共void done(列出对象,parsee异常){
如果(e==null){
对于(inti=0;i,您必须在parse.com上启用该选项
转到parse.com上的设置==>推送==>“已启用客户端推送”是