How to set credential persistence permanent on Android
        Posted  
        
            by 
                doreamon
            
        on Stack Overflow
        
        See other posts from Stack Overflow
        
            or by doreamon
        
        
        
        Published on 2012-12-20T10:54:01Z
        Indexed on 
            2012/12/20
            11:03 UTC
        
        
        Read the original article
        Hit count: 223
        
My app has save login credential feature, so I store cookies for the next use after succeeding to sign in. However, after a time period, the session will be time out and cannot log in with the cookies any more. On iOS, after setting credential persistence to permanent, the app works nicely even after restarting the phone:
[[challenge sender] useCredential:[NSURLCredential credentialWithUser:username password:password persistence:NSURLCredentialPersistencePermanent] forAuthenticationChallenge:challenge];
On Android, I cannot find out such kind of this option. Here is from my HttpHelper class:
((AbstractHttpClient) HttpHelper.client).getAuthSchemes().register("ntlm",new NTLMSchemeFactory());
  NTCredentials creds = new NTCredentials(user, pass, "", domain);
  ((AbstractHttpClient) HttpHelper.client).getCredentialsProvider().setCredentials(AuthScope.ANY, creds);
The server is SharePoint so I have to deal with ntlm authentication by following this instruction
If you have idea, please let me know.
Thank you.
© Stack Overflow or respective owner