Android Parse: unable to update local user

I have a custom logical field called Approved in my custom ParseUser object. We change this field from false to true through the web application. According to the documentation, I should be able to update currentUser after changing the flag using fetchInBackground (), for example:

ParseUser.getCurrentUser().fetchInBackground(new GetCallback<ParseObject>() { @Override public void done(ParseObject parseObject, ParseException e) { Log.v("qwer", "fetched User: " + ((CustomUser)parseObject).isApproved()); } }); 

But even if the approved flag is set to true, the result returned from the server is always false. If I do not log out and log into the system again, at what point currentUser and the corresponding field will be synchronized with the server.

Why fetchInBackground () does not work for the local user, and if I use it incorrectly, how to update currentUser.

+6
source share
1 answer

Refer to this link, you need to use pinInBackground , and also enable local data storage with Parse.enableLocalDatastore(yourContext); in your Application class.


Update:

Not sure if this will help you, but I have a similar situation with you:

I am doing typical user.put("userVerified", true); , then user.saveInBackground to save a boolean indicating whether the user has been verified, and then in the next step I use user.getBoolean("userVerified") to retrieve the flag ... That would be what you would think

+1
source

All Articles