public final class LiSDKManager
extends java.lang.Object
Modifier and Type | Field and Description |
---|---|
protected LiAppCredentials |
liAppCredentials |
Modifier and Type | Method and Description |
---|---|
void |
fetchFreshAccessToken(android.content.Context context,
LiAuthService.FreshTokenCallBack mFreshTokenCallBack)
Fetches Fresh Access Token and Persists it.
|
android.net.Uri |
getCommunityUrl()
Returns community URI.
|
java.lang.String |
getCoreSDKVersion()
gets the core sdk version
|
java.lang.String |
getFromSecuredPreferences(android.content.Context context,
java.lang.String key) |
static LiSDKManager |
getInstance()
Instance of this.
|
LiAppCredentials |
getLiAppCredentials()
Returns AppCredentials.
|
LiDeviceTokenProvider |
getLiDeviceTokenProvider() |
LiUser |
getLoggedInUser()
Fetches the current logged in User.
|
boolean |
getNeedsTokenRefresh()
Checks if need to getch fresh access tokens.
|
java.lang.String |
getNewAuthToken()
Returns Access Token.
|
java.lang.String |
getProxyHost()
Returns proxy host received along with auth code .
|
java.lang.String |
getRefreshToken()
Returns Refresh Token.
|
java.lang.String |
getTenant()
Returns tenant id received along with auth code .
|
static LiSDKManager |
init(android.content.Context context,
LiAppCredentials liAppCredentials)
Initiales LiSDKManager and initiates the login flow.
|
void |
initLoginFlow(android.content.Context context)
Login flow is initiated from here and then call goes to LiAuthService
|
void |
initLoginFlow(android.content.Context context,
LiDeviceTokenProvider liDeviceTokenProvider)
Login flow is initiated from here and then call goes to LiAuthService
|
void |
initLoginFlow(android.content.Context context,
java.lang.String ssoToken)
Login flow is initiated from here and then call goes to LiAuthService
|
void |
initLoginFlow(android.content.Context context,
java.lang.String ssoToken,
LiDeviceTokenProvider liDeviceTokenProvider)
Login flow is initiated from here and then call goes to LiAuthService
|
static boolean |
isEnvironmentInitialized()
Checks whether the SDK is initialized.
|
boolean |
isUserLoggedIn()
Checks if the user is logged in.
|
void |
logout(android.content.Context context)
Flushes auth state when a call to logout is made.
|
void |
persistAuthState(android.content.Context context,
LiSSOAuthResponse authorizationResponse)
persists Auth State in shared preference when Authorization Response is received
|
void |
persistAuthState(android.content.Context context,
LiTokenResponse response)
persists Auth State in shared preference when Token Response is received
|
boolean |
putInSecuredPreferences(android.content.Context context,
java.lang.String key,
java.lang.String value) |
boolean |
removeFromSecuredPreferences(android.content.Context context,
java.lang.String key) |
lithium.community.android.sdk.manager.LiAuthState |
restoreAuthState(android.content.Context context)
Fetches Auth State from Shared Preference.
|
void |
setLiDeviceTokenProvider(LiDeviceTokenProvider liDeviceTokenProvider) |
void |
setLoggedInUser(android.content.Context context,
LiUser user)
Sets User
|
void |
syncWithCommunity(android.content.Context context) |
protected final LiAppCredentials liAppCredentials
public static boolean isEnvironmentInitialized()
public static LiSDKManager init(android.content.Context context, LiAppCredentials liAppCredentials) throws java.net.URISyntaxException
context
- Context
liAppCredentials
- LiAppCredentials
java.net.URISyntaxException
- URISyntaxException
public static LiSDKManager getInstance()
public void syncWithCommunity(android.content.Context context)
public android.net.Uri getCommunityUrl()
public LiAppCredentials getLiAppCredentials()
public java.lang.String getCoreSDKVersion()
public LiDeviceTokenProvider getLiDeviceTokenProvider()
public void setLiDeviceTokenProvider(LiDeviceTokenProvider liDeviceTokenProvider)
public LiUser getLoggedInUser()
public void setLoggedInUser(android.content.Context context, LiUser user)
user
- public java.lang.String getNewAuthToken()
public java.lang.String getRefreshToken()
public void initLoginFlow(android.content.Context context) throws java.net.URISyntaxException
context
- Context
java.net.URISyntaxException
public void initLoginFlow(android.content.Context context, java.lang.String ssoToken) throws java.net.URISyntaxException
context
- Android contextssoToken
- pass the Single Sign-on token if the community uses its own identity providerjava.net.URISyntaxException
public void initLoginFlow(android.content.Context context, LiDeviceTokenProvider liDeviceTokenProvider) throws java.net.URISyntaxException
context
- Android contextliDeviceTokenProvider
- this provider fetches device token id based upon whatever the app is using.
Either Firebase or GCMjava.net.URISyntaxException
public void initLoginFlow(android.content.Context context, java.lang.String ssoToken, LiDeviceTokenProvider liDeviceTokenProvider) throws java.net.URISyntaxException
ssoToken
- pass the Single Sign-on token if the community uses its own identity providerliDeviceTokenProvider
- this provider fetches device token id based upon whatever the app is using.
Either Firebase or GCMcontext
- Context
java.net.URISyntaxException
public boolean removeFromSecuredPreferences(android.content.Context context, java.lang.String key)
public boolean putInSecuredPreferences(android.content.Context context, java.lang.String key, java.lang.String value)
public java.lang.String getFromSecuredPreferences(android.content.Context context, java.lang.String key)
public void persistAuthState(android.content.Context context, LiSSOAuthResponse authorizationResponse)
context
- Context
authorizationResponse
- LiSSOAuthResponse
public void persistAuthState(android.content.Context context, LiTokenResponse response)
context
- Context
response
- LiTokenResponse
public void logout(android.content.Context context)
context
- Context
public boolean isUserLoggedIn()
public final lithium.community.android.sdk.manager.LiAuthState restoreAuthState(android.content.Context context)
context
- Context
public java.lang.String getProxyHost()
public java.lang.String getTenant()
public boolean getNeedsTokenRefresh()
public void fetchFreshAccessToken(android.content.Context context, LiAuthService.FreshTokenCallBack mFreshTokenCallBack) throws java.net.URISyntaxException, LiRestResponseException
context
- Context
mFreshTokenCallBack
- LiAuthService.FreshTokenCallBack
java.net.URISyntaxException
- URISyntaxException
LiRestResponseException
- LiRestResponseException