2014-09-27 255 views
0

我遇到了解析推送通知問題,我試圖實現用戶到用戶推送通知,並在後端它確實顯示郵件已發送,但實際上郵件沒有被顯示給用戶。推送通知的問題

此外,似乎該消息發送到查詢中的所有用戶,它應該只發送給匹配的用戶。

下面是與推送通知

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) { 




      } 
     } 
    }); 

任何援助將不勝感激交易的代碼的部分。

回答

0

您必須啓用parse.com上parse.com

進入選項設置==>推==>「啓用客戶端推送」是的。