When the user clicks on the "find random opponent" button, I would like the User class in Parse to create a new field (called readyToPlay) and set the value to true. Then, start a new activity where the user is randomly matched with other users whose variable readyToPlay is also set to true.
The problem is when I click the "find random opponent" button, no new field is created. I looked at the Parse documentation and cant figure out what I am doing wrong. I have attached the relevant code below.
public void onClick(View v) {
Intent intent = new Intent(MainActivity.this, FindRandomOpponent.class);
ParseUser currentUser = ParseUser.getCurrentUser();
currentUser.put(ParseConstants.KEY_READY_TO_PLAY, true);
currentUser.saveInBackground()
startActivity(intent);
}
Edit1: I called the saveInBackground method, but my user database didn't update.
Edit2: I am currently signed in as a user, so the device does have access to the internet.