我需要在一对一聊天中找到聊天用户的在线状态 但它总是显示超过5分钟。
/** The current time. */
long currentTime;
/** The user's last requested time. */
long userLastRequestAtTime;
currentTime = System.currentTimeMillis();
userLastRequestAtTime = qbUsers.getLastRequestAt().getTime();
// if user didn't do anything last 5 minutes (5*60*1000 milliseconds)
if((currentTime - userLastRequestAtTime) > 5*60*1000) {
LogMessage.v("status","offline");
else
LogMessage.v("status","online");
答案 0 :(得分:0)
您添加了延迟状态更新的条件
您需要删除此行
if((currentTime - userLastRequestAtTime) > 5*60*1000)