Join the social network of Tech Nerds, increase skill rank, get work, manage projects...
 
  • How to send a status message to my server when android activity get closed ?

    • 0
    • 1
    • 0
    • 0
    • 0
    • 0
    • 0
    • 0
    • 157
    Comment on it

    Sometime we wish to track our user activity when user closed particular activity in app so we can follow this life cycle of Activity :

    If you want to send status to your server when application closed or force quit then you should use override method onPause() because this method always guarantee to run if your app get closed or forcefully quit. Don't use onStop() because in case of force quit this method will not work. Don't use onDestroy() because this method will work when your activity will get destroyed.

        @Override 
    public void onPause() 
    {
    doSomething();
    super.onPause();
    }
    

    You can set some api to update server in doSomething() method.

 0 Comment(s)

Sign In
                           OR                           
                           OR                           
Register

Sign up using

                           OR                           
Forgot Password
Fill out the form below and instructions to reset your password will be emailed to you:
Reset Password
Fill out the form below and reset your password: