none
How to avoid login every time user opens the Android application? RRS feed

  • Question

  • Hello,

    I have integrated office 365 SDK in my Android Application and it is working absolutely fine. However the problem I'm facing is that if user closes the application and after some time if user opens it again then user in office 365 SDK is logging out automatically.

    This problem is not occurring every time when user launches the application. Only sometimes this problem is occurring.

    Probably in following cases:

    • When device is kept as it is for a long and application is opened...
    • When device is not connected to internet and application is opened...
    • Sometimes when device is kept as it is for a long and at the next launch even device is connected to internet.

    I've used following code to launch a login screen. 

    AuthenticationManager.getInstance().setContextActivity(this);
    
            AuthenticationManager.getInstance().connect(
                    new AuthenticationCallback<AuthenticationResult>() {
                        /**
                         * If the connection is successful, the activity extracts the username and
                         * displayableId values from the authentication result object and sends them
                         * to the SendMail activity.
                         *
                         * @param result The authentication result object that contains information about
                         *               the user and the tokens.
                         */
                        @Override
                        public void onSuccess(AuthenticationResult result) {
                            Log.i("Office365", "onConnectButtonClick - Successfully connected to Office 365");    
                        }
    
    
                        @Override
                        public void onError(final Exception e) {
                            Toast.makeText(LandingActivity.this, "Authentication error encountered.", Toast.LENGTH_SHORT).show();
                            Log.e("Office365", "onCreate - " + e.getMessage());
                        }
                    });
    

    What are the scenarios that user have to login in into the application?

    Is it possible to never logout the user from application?

    Monday, August 1, 2016 9:51 AM