Q:

Session issue with Quickblox Chat

While using Quickblox chat, How do i destroy the session when i close the app?  so that when i start the app next time it should be able to login in to chat. 
What i have tried is calling the deleteSession on onDestroy of my MainActivity, but it doesnt seems to help. 
@Override
public void onDestroy() {
    super.onDestroy();
    QBUsers.signOut(new QBEntityCallbackImpl() {
        @Override
        public void onSuccess() {
            Log.v("SESSION","Session logout");
            ChatService.getInstance().removeConnectionListener(chatConnectionListener);
            QBAuth.deleteSession(new QBEntityCallback<Void>() {
                @Override
                public void onSuccess(Void aVoid, Bundle bundle) {
                    Log.v("SESSION","Session destroyed");

                }

                @Override
                public void onSuccess() {
                    Log.v("SESSION","Session destroyed 2");
                    //i get success here, when i onDestroy is called

                }

                @Override
                public void onError(List<String> list) {
                    Log.v("SESSION",list.toString());
                }
            });
        }

        @Override
        public void onError(List errors) {
            Log.v("SESSIONERROR",errors.toString());
        }
    });
}

Situation:
When i start the app, it gets the Quickblox session and logs in to the chat. 
but if i close the app.  next time when i start the app, it gets the Quickblox session and gets stuck there. 
I need to kill the app from task manager and start the app to login. 
SDK response when i make a fresh start
01-23 23:04:07.017 21733-21733/?  D/ChatService: Initialise QBChatService
01-23 23:04:07.027 21733-21733/?  D/QBASDK: =========================================================
                                           === REQUEST ==== 66f6e80c-9319-48c6-8d55-374d83c715e2 ===
                                           REQUEST
                                               POST https://api.quickblox.com/session.json
                                           HEADERS
                                               QuickBlox-REST-API-Version=0.1.1
                                               QB-SDK=Android 2.3.3
                                           PARAMETERS
                                               application_id=xxxx
                                               auth_key=U48ZQsXad2OcBNa
                                               nonce=-855163362
                                               timestamp=1453570447
                                               user[login]=egun1234
                                               user[password]=egun1234
                                               signature=f3edc13692c8ad3d4aae90717be7c05890ea4780
                                           INLINE
                                               POST https://api.quickblox.com/session.json?application_id=xxxxx&auth_key=U48ZQsXad2OcBNa&nonce=-855163362&timestamp=1453570447&user[login]=egun1234&user[password]=egun1234&signature=f3edc13692c8ad3d4aae90717be7c05890ea4780
01-23 23:04:12.047 21733-21733/?  D/QBASDK: *********************************************************
                                           *** RESPONSE *** 66f6e80c-9319-48c6-8d55-374d83c715e2 ***
                                           STATUS : 201 
                                           HEADERS
                                               Access-Control-Allow-Origin=*
                                               Cache-Control=max-age=0, private, must-revalidate
                                               Connection=keep-alive
                                               Content-Length=270
                                               Content-Type=application/json; charset=utf-8
                                               Date=Sat, 23 Jan 2016 17:34:01 GMT
                                               ETag="b6aee90833f76c7e670ffb4b24a8a7a5"
                                               QB-Token-ExpirationDate=2016-01-23 19:34:01 UTC
                                               QuickBlox-REST-API-Version=0.1.1
                                               Server=nginx/1.6.2
                                               Status=201 Created
                                               Strict-Transport-Security=max-age=15768000;
                                               X-Rack-Cache=invalidate, pass
                                               X-Request-Id=e42acfadd6cb14f5b396587c0d837551
                                               X-Runtime=0.035198
                                               X-UA-Compatible=IE=Edge,chrome=1
                                           BODY
                                               '{"session":{"_id":"56a3b989a0eb471c5a00000f","application_id":xxxx,"created_at":"2016-01-23T17:34:01Z","device_id":0,"nonce":-855163362,"token":"767c6cadc31c5e6c45ba64ef29d45a9b28a2bd0d","ts":1453570447,"updated_at":"2016-01-23T17:34:01Z","user_id":7748679,"id":42627}}'
01-23 23:04:12.127 21733-21757/?  D/QBASDK: Connecting to chat..
01-23 23:04:15.127 21733-21757/?  D/QBASDK: Connected.  Login to chat, currentUser JID: 7748679-xxxxx, resource: 811ee375c6eff567

SDK response when i just close the app and start it again(app is still in task manager)
01-23 23:14:40.617 21733-21733/?  D/QBASDK: =========================================================
                                           === REQUEST ==== ed61d1eb-a18d-4ba9-b730-8b552e5e46bc ===
                                           REQUEST
                                               POST https://api.quickblox.com/session.json
                                           HEADERS
                                               QuickBlox-REST-API-Version=0.1.1
                                               QB-SDK=Android 2.3.3
                                               QB-Token=767c6cadc31c5e6c45ba64ef29d45a9b28a2bd0d
                                           PARAMETERS
                                               application_id=xxxxx
                                               auth_key=U48ZQsXad2OcBNa
                                               nonce=1359179285
                                               timestamp=1453571080
                                               user[login]=egun1234
                                               user[password]=egun1234
                                               signature=f99dda85c65db5aff212512939fed7408f14461e
                                           INLINE
                                               POST https://api.quickblox.com/session.json?application_id=xxxxx&auth_key=U48ZQsXad2OcBNa&nonce=1359179285&timestamp=1453571080&user[login]=egun1234&user[password]=egun1234&signature=f99dda85c65db5aff212512939fed7408f14461e
01-23 23:14:48.657 21733-21733/?  D/QBASDK: *********************************************************
                                           *** RESPONSE *** ed61d1eb-a18d-4ba9-b730-8b552e5e46bc ***
                                           STATUS : 201 
                                           HEADERS
                                               Access-Control-Allow-Origin=*
                                               Cache-Control=max-age=0, private, must-revalidate
                                               Connection=keep-alive
                                               Content-Length=270
                                               Content-Type=application/json; charset=utf-8
                                               Date=Sat, 23 Jan 2016 17:44:37 GMT
                                               ETag="778f1e9b028ecb55f5d5aaf210f22c5f"
                                               QB-Token-ExpirationDate=2016-01-23 19:44:37 UTC
                                               QuickBlox-REST-API-Version=0.1.1
                                               Server=nginx/1.6.2
                                               Status=201 Created
                                               Strict-Transport-Security=max-age=15768000;
                                               X-Rack-Cache=invalidate, pass
                                               X-Request-Id=9d23abaa4c411a42bb466a65c9aa78bc
                                               X-Runtime=0.041888
                                               X-UA-Compatible=IE=Edge,chrome=1
                                           BODY
                                               '{"session":{"_id":"56a3bc05a0eb47f007000097","application_id":xxxxx,"created_at":"2016-01-23T17:44:37Z","device_id":0,"nonce":1359179285,"token":"3fdf2abc49d381c5827db4647bade2c51db9b64d","ts":1453571080,"updated_at":"2016-01-23T17:44:37Z","user_id":7748679,"id":42501}}'

A:

There was no need to do anything with session or login in onDestroy
Just making a check in onResume of Splash Activity solved my issues. 
@Override
    protected void onResume() {
        super.onResume();
        if (isChatLoggedIn()) {
            decideLaunchActivity();
            finish();
        }
    }
    private boolean isChatLoggedIn() {
        return QBChatService.isInitialized() && QBChatService.getInstance().isLoggedIn();
    }

