We are developing an instant messaging App, and would need to display the "presence" of user's friends with a green dot on their avatars.
"Presence" goes far beyond "my_app_is_opened_and_on_focus", it means (and I guess one could have many definitions of "presence"): user has been using his device to do anything (even just checking time) during the last 2 or 5 minutes.
Any idea on how could we get this "presence" or "generic recent activity" information and log it on our server even if our app is closed? (on iOS and Android)