cometchat / chat-sdk-android

Text Chat SDK for Android
https://www.cometchat.com
22 stars 12 forks source link

[2.1.0] User's Last Active time is incorrect #34

Closed masterofn1 closed 3 years ago

masterofn1 commented 4 years ago

Describe the bug User's Last Active time is incorrect even after updating the user last Active time

To Reproduce Steps to reproduce the behavior:

  1. Update the user status
  2. Update the last active time of the said user

Expected behavior

The submitted "lastActiveAt" of the certain user should be the latest one being passed on the sdk's method CometChat.updateUser

Actual behavior

The response of the method requests always give incorect time. In my case it was always in year 1970

Enviorment/Platfrom (please complete the following information):

Files (Optional)

Logs (Error Logs)

**Response Data**:
User{uid='kenadmin', name='ken admin', avatar='https://dev.lemi.travel/avatar/kenadmin?context=chat', link='null', role='default', metadata=null, status='offline', statusMessage='null', lastActiveAt=1599662517, hasBlockedMe=false, blockedByMe=false}

**Submitted Data**:
User{uid='kenadmin', name='ken admin', avatar='https://dev.lemi.travel/avatar/kenadmin?context=chat', link='null', role='default', metadata=null, status='offline', statusMessage='null', lastActiveAt=1599662518083, hasBlockedMe=false, blockedByMe=false}
adityagokula2210 commented 4 years ago

Hello @masterofn1 , The lastActiveAt field cannot be updated via the SDKs. The lastActiveAt field is set based on the user sessions being created and destroyed based on the connection to the CometChat Web-socket server.

Hope this helps. Thanks

masterofn1 commented 4 years ago

Hello @masterofn1 , The lastActiveAt field cannot be updated via the SDKs. The lastActiveAt field is set based on the user sessions being created and destroyed based on the connection to the CometChat Web-socket server.

Hope this helps. Thanks

What will you recommend for us to capture the last active time of the user? it always pointed back to year 1970

adityagokula2210 commented 4 years ago

@masterofn1 The lastActiveAt field will only be set for the users who have logged in at least once into CometChat. What I would suggest is that you check if the lastActiveAt field. If it is set to 0, it means that the user has not logged in to CometChat. If the lastActiveAt field is not 0, it means it shows the timestamp of the last time the user was connected to the CometChat web-socket servers.

Thanks