private void initPostQueries() {
postQuery = new AVQuery<>("Post");
postQuery.whereGreaterThan("id", 0);
postQuery.whereNotEqualTo("content", "");
postQuery.whereEqualTo("isDead", false);
postQuery.orderByDescending("updatedAt");
postQuery.limit(100); //todo: 调整下该数值;
postLiveQuery = AVLiveQuery.initWithQuery(postQuery);
postLiveQuery.setEventHandler(new AVLiveQueryEventHandler() {
@Override
public void onObjectCreated(AVObject newTodo) {
System.out.println("=== post created");
}
@Override
public void onObjectLeave(AVObject avObject, List<String> updateKeyList) {
super.onObjectLeave(avObject, updateKeyList);
System.out.println("=== post onObjectLeave");
}
@Override
public void onObjectUpdated(AVObject avObject, List<String> updateKeyList) {
super.onObjectUpdated(avObject, updateKeyList);
System.out.println("=== post onObjectUpdated");
}
@Override
public void onUserLogin(AVUser user) {
super.onUserLogin(user);
System.out.println("=== post onObjectUpdated");
}
});
postLiveQuery.subscribeInBackground(new AVLiveQuerySubscribeCallback() {
@Override
public void done(AVException e) {
if (e == null) {
System.out.println("=== post LiveQuery done");
} else {
System.out.println("=== post LiveQuery error:" + e);
}
}
});
}
这段代码的订阅无效,有什么debug的方案没,同样的另个一个订阅就完全是好的,而且印象里这段代码之前测试的时候是没问题 的。