如何从 parse.com (android) 中检索 updated/changed 数据?
How to retrieve updated/changed data from parse.com (android)?
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);
我已通过上面显示的代码检索帖子并保存在解析 localDatastore 中。
后来我用了 ParseQuery<ParseObject> query = ParseQuery.getQuery(ParseConstants.CLASS_POSTS);
query.fromLocalDatastore();
在本地获取帖子。
但是通过 pinAllInBackground 方法,整个帖子副本被下载并保存在本地商店中。我只想固定新帖子。我应该调用哪个方法?
我找到了解决办法。
要仅检索新数据,我们应该通过将其添加到查询来比较 createdAt。
query.whereGreaterthanOrEqualTo("createdAt",dateOfLastRetrievedObject);
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);
我已通过上面显示的代码检索帖子并保存在解析 localDatastore 中。
后来我用了 ParseQuery<ParseObject> query = ParseQuery.getQuery(ParseConstants.CLASS_POSTS);
query.fromLocalDatastore();
在本地获取帖子。
但是通过 pinAllInBackground 方法,整个帖子副本被下载并保存在本地商店中。我只想固定新帖子。我应该调用哪个方法?
我找到了解决办法。 要仅检索新数据,我们应该通过将其添加到查询来比较 createdAt。
query.whereGreaterthanOrEqualTo("createdAt",dateOfLastRetrievedObject);