108
Views
3
Comments
how to retrieve the last device that used to login?
Discussion

i wan to get the last device, for some condition in my action. how to retrieve it?

2020-09-15 13-07-23
Kilian Hekhuis
 
MVP

Hi Erron,

Afaik the platform doesn't log devices. What is your scenario?

2017-08-22 01-53-41
Erron Lolha

Kilian Hekhuis wrote:

Hi Erron,

Afaik the platform doesn't log devices. What is your scenario?

I want to create a condition to log out, where take device id used to login again whether the user using the same device or not?

2020-02-12 17-14-01
Ahmad Abdullah
Staff

As per the below thread my understanding is that you have 2 main challenges,

  • Make sure that you have 1 active user login from 1 device not multiple devices.
  • Make sure that no multiple users can access the same device.

To do so you will need the following,

  • Database Entity to store UserID  & Device ID.
  • Local Storage Entity to store Current User Id & Device Id.

In the first screen after login you will have to do the following checks,

  • Get current User ID and search in the Local Storage & Server for the Devices info.
  • Search by UserID in Local Storage,
    • If Exists then update it.
    • If not then create it.
  • Search by UserID & Device ID on Server,
    • Delete the results. Why delete? you might do 2 search queries by UserID & DeviceID and gets 2 different rows, so which one to update & which to delete? Unless you don’t have a logic or a key to keep the row with current device or keep the row with the current row, delete both.
    • Create a new one record with new data.
  • You will need to check on app resume every time if the server data is different than local then logout & if not then remains,

Please let me know what do you think ?

Community GuidelinesBe kind and respectful, give credit to the original source of content, and search for duplicates before posting.