1

Guys I am creating an Online Android App, my server-side is taken care with php. Everything is going good. The app is working as per my concept.

Now I need to add a new feature in my app where i means the server need to know if the user is online now in his android app. How can i achieve this. Please help me out.

In the app when a user first downloaded and run the app, he/she need to register first and then login, as soon as he logs in, I stored his login data in "SharedPreferences", so that no need for the user to login every-time he opens the app.

Any help will be appreciated. Thanks.

1 Answer 1

2

You can implement this method on Activity to keep knowledge that user is interacting with application (Online/Active/Not interacting, etc.). You can post your status to the server in this method.

@Override 
public void onUserInteraction() 
{ 
}
Sign up to request clarification or add additional context in comments.

6 Comments

ur answer is really helpful, now i am googling to get its exact implementation. Thanks dude
........one more help needed, how i know that the user has closed the app.
You can implement onDestroy() method.
You can also refer Auto Logout after defined time(minutes)github.com/pritamworld/AutoLogoutExample
|

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.