I have a custom boolean field called Approved in my custom ParseUser object. We change this field from false to true via a web app. According to the documentation, I should be able to update currentUser after changing the flag with fetchInBackground(), like this:
ParseUser.getCurrentUser().fetchInBackground(new GetCallback<ParseObject>() {
@Override
public void done(ParseObject parseObject, ParseException e) {
Log.v("qwer", "fetched User: " + ((CustomUser)parseObject).isApproved());
}
});
But even though the approved flag has been set to true, the result coming back from the server is always false. Unless I logout and login again, at which point currentUser and the respective field is synced with the server.
Why doesn't fetchInBackground() work for the local user, and if I'm using it incorrectly, how do I update the currentUser.
Please see this link, the point is to use pinInBackground
and also enable local datastore with Parse.enableLocalDatastore(yourContext);
in your Application
class.
Update:
Not sure if this will help you, but I do have a similar situation with you:
I do a typical user.put("userVerified", true);
then user.saveInBackground
to save a boolean that indicates whether user has been verified, then in the next activity I use user.getBoolean("userVerified")
to retrieve the flag...Would this be something you might consider?
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With