我正在使用firebase聊天。
mDatabaseReference = FirebaseDatabase.getInstance().getReference();
mDatabaseReference.addChildEventListener(new ChildEventListener() {
@Override
public void onChildAdded(DataSnapshot dataSnapshot, String s) {
try {
if (dataSnapshot != null && dataSnapshot.getValue() != null) {
Message model = dataSnapshot.getValue(Message.class);
mMessageList.add(model);
getViewState().updateRecyclerView();
if(mCurrentPositionVisibleLost + 1 == mMessageList.size() - 1 || mCurrentPositionVisibleLost == 0){
getViewState().scrollToPositionBottom();
}
}
}catch (Throwable throwable){
System.out.println("Error " + throwable.getMessage());
}
......
如何断开与服务器的连接?我如何登录时只上传10封邮件?
答案 0 :(得分:0)
DatabaseReference.getDatabase()goOffline();