I am using linkedin-j library for authenication
I want to persist the LinkedIn Access token object.
LinkedInOAuthService oAuthService = LinkedInOAuthServiceFactory
.getInstance()
.createLinkedInOAuthService(
LK_CONSUMER_KEY, LK_CONSUMER_SECRET
);
//Need to persist this accessToken
LinkedInAccessToken accessToken = oAuthService
.getOAuthAccessToken(liToken, oauthVerifier);
You can use SharedPreferences.
This is an example shown for Facebook. You can implement the same way for for LinkedIn.
When the user has logged in:
When you app starts, in
onCreate
, restore the session if it exists:Source: https://developers.facebook.com/blog/post/640/