How to retrieve updated/changed data from parse.com (android)?

153 views Asked by At
ParseQuery<ParseObject> query = new ParseQuery<ParseObject>(
                            ParseConstants.CLASS_POSTS);
                    query.findInBackground(new FindCallback<ParseObject>() {

                        @Override
                        public void done(List<ParseObject> posts, ParseException e) {

                            if (e == null) {
                                // we found posts
                                mPosts = posts;


                                ParseObject.pinAllInBackground(mPosts);

I have retrieved posts and saved on parse localDatastore by code shown above. and later I have used ParseQuery<ParseObject> query = ParseQuery.getQuery(ParseConstants.CLASS_POSTS); query.fromLocalDatastore(); to get posts locally.

But by pinAllInBackground method whole copy of posts get downloaded and saved in localstore. I just want to pin new posts. which method I should call?

1

There are 1 answers

0
Thesoham24 On BEST ANSWER

I have found solution. to retrieve only new data we should compare createdAt by adding this to query.

query.whereGreaterthanOrEqualTo("createdAt",dateOfLastRetrievedObject);