We have functionality for offline group push notification from the server.
Scenario below: -
The application is open and go to the group message tab. Now send a message to the group so that other users of the group receive the message that I sent.
Closing (kill or in the background) the application from the end of ios, they establish the presence of users offline. Therefore, as soon as the application is closed, they will receive a push notification in their mobile phone.
The problem is closing the application, but I get a push notification on my mobile phone, although I am reading the same message.
In the background, I installed a cron task that runs on the server every 30 seconds, and checks for the presence of the user in the group and sends a push notificaiton to those users who are offline on their mobile device.
So, is there a way to get the last logout timestamp using the REST API so that I can put the condition and check if the last user logged in time is less than the current time that push notificaitons will send.
Unable to get recent logout time using REST API
http://example.com:9090/plugins/restapi/v1/sessions/yourUserName
which displays: -
<?xml version="1.0" encoding="UTF-8" standalone="yes"?> <sessions>
<session>
<sessionId>yourUserName@example.com/1ae2xq14da</sessionId>
<username>yourUserName</username>
<ressource>1ae2xq14da</ressource>
<node>Local</node>
<sessionStatus>Closed</sessionStatus>
<presenceStatus>Online</presenceStatus>
<priority>0</priority>
<creationDate>2017-01-18T08:58:01.611Z</creationDate>
<lastActionDate>2017-01-18T08:58:05.121Z</lastActionDate>
<secure>false</secure>
</session>
</sessions>
By performing the method described above without receiving the creation date and the date of the last action.
1) creationDate: - 2017-01-18T08: 58: 01.611Z
2) lastActionDate: - 2017-01-18T08: 58: 05.121Z
http://example.com:9090/plugins/restapi/v1/users/yourUserName
<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<user>
<username>yourUserName</username>
<name>yourUserName</name>
<email>yourUserName@example.com</email>
<properties/>
</user>
REST API Plugin
.