Package com.cheetahdigital.corekit.sdk
Class Sdk
- java.lang.Object
-
- com.cheetahdigital.corekit.sdk.Sdk
-
public final class Sdk extends java.lang.ObjectContains all the basic api calls in the core kit
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static interfaceSdk.LogoutListener
-
Field Summary
Fields Modifier and Type Field Description static java.lang.StringMEMBER_ID_KEY
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description voidclearMemberId()java.lang.StringgetAccessToken()Get the currently stored Loyalty API Access TokenAuthenticatorServicegetAuthenticatorService()java.lang.StringgetClientId()java.lang.StringgetClientSecret()java.lang.StringgetClientUrl()android.content.ContextgetContext()Get the application contextstatic SdkgetInstance()java.lang.StringgetMemberId()java.lang.StringgetRefreshToken()Get the currently stored Loyalty API Refresh TokenSdkConfiggetSdkConfig()static voidinitialize(android.app.Application application)Initialize the SDKstatic voidinitialize(android.app.Application application, SdkConfig sdkConfig)Initialize the SDK using the givenEndpoint.static booleanisInitialized()Indicated whether the Android Core SDK is initialized.booleanisLoggedIn()Check if a member is currently Logged in via SDK.booleanisSendLocationAnonymously()Flag for checking if sending of location anonymously is allowedbooleanisThirdPartyAuth()Returns a boolean which indicates if the authentication was made by a third party authenticator.booleanisTokenExpired()Check if the stored Loyalty API Access Token is already expired.voidlogin(java.lang.String jwToken)Login via java web tokenvoidlogout()Log out the current user.voidrefreshToken()Refresh the currently stored Loyalty API Access Token.voidresendEmailConfirmation(java.lang.String email, ListenerModel<BaseModel<Message>,Message> listener)voidsaveMemberId(java.lang.String memberId)voidsetRequireResetPassword(boolean value)Set the flag that indicates whether user should reset passwordvoidsetSendLocationAnonymously(boolean isEnabled)Sets the flag that indicates whether sending of location anonymously is allowedbooleanshouldRequireResetPassword()Flag for checking if the user should reset the passwordvoidtrackAppUsage()Track the users activity Once the app is launche the user will be tagged as active
-
-
-
Field Detail
-
MEMBER_ID_KEY
public static final java.lang.String MEMBER_ID_KEY
- See Also:
- Constant Field Values
-
-
Constructor Detail
-
Sdk
public Sdk(android.app.Application application, SdkConfig sdkConfig)
-
-
Method Detail
-
getInstance
public static Sdk getInstance()
-
initialize
public static void initialize(android.app.Application application, SdkConfig sdkConfig)Initialize the SDK using the givenEndpoint.- Parameters:
application- the current AndroidApplicationsdkConfig- the current SDK config
-
initialize
public static void initialize(android.app.Application application)
Initialize the SDK- Parameters:
application- the current applicationApplication
-
getAuthenticatorService
public AuthenticatorService getAuthenticatorService()
- Returns:
- instance of
AuthenticatorService
-
getContext
public android.content.Context getContext()
Get the application context- Returns:
- Context
Context
-
login
public void login(java.lang.String jwToken)
Login via java web token- Parameters:
jwToken- third party java web token
-
isInitialized
public static boolean isInitialized()
Indicated whether the Android Core SDK is initialized.- Returns:
- true if initialized, false if not
-
getAccessToken
public java.lang.String getAccessToken()
Get the currently stored Loyalty API Access Token- Returns:
- access token which is currently stored in your
Applicationinstance
-
isThirdPartyAuth
public boolean isThirdPartyAuth()
Returns a boolean which indicates if the authentication was made by a third party authenticator.- Returns:
trueif authentication is from third partyfalseif authentication is from loyalty
-
getRefreshToken
public java.lang.String getRefreshToken()
Get the currently stored Loyalty API Refresh Token- Returns:
- refresh token which is currently stored in your
Applicationinstance
-
getClientId
public java.lang.String getClientId()
- Returns:
- client id which is currently stored in your
Applicationinstance
-
getClientUrl
public java.lang.String getClientUrl()
- Returns:
- client url which is currently stored in your
Applicationinstance
-
getClientSecret
public java.lang.String getClientSecret()
- Returns:
- client secret which is currently stored in your
Applicationinstance
-
isLoggedIn
public boolean isLoggedIn()
Check if a member is currently Logged in via SDK.- Returns:
- true if current user is Logged in, false otherwise
-
shouldRequireResetPassword
public boolean shouldRequireResetPassword()
Flag for checking if the user should reset the password- Returns:
- true if reset password is required, else false
-
setRequireResetPassword
public void setRequireResetPassword(boolean value)
Set the flag that indicates whether user should reset password- Parameters:
value- true to enable reset password, else false
-
isSendLocationAnonymously
public boolean isSendLocationAnonymously()
Flag for checking if sending of location anonymously is allowed- Returns:
- true if send location anonymously is enabled, else false
-
setSendLocationAnonymously
public void setSendLocationAnonymously(boolean isEnabled)
Sets the flag that indicates whether sending of location anonymously is allowed- Parameters:
isEnabled- true - sending of location to server is allowed, false - sending of location to server is not allowed
-
isTokenExpired
public boolean isTokenExpired()
Check if the stored Loyalty API Access Token is already expired.- Returns:
- true if expired, false if not
-
logout
public void logout()
Log out the current user. This method also removes the stored values (Access and Refresh Tokens, etc.) in your currentApplication.
-
refreshToken
public void refreshToken()
Refresh the currently stored Loyalty API Access Token. Usually done after checking ifisTokenExpired().
-
trackAppUsage
public void trackAppUsage()
Track the users activity Once the app is launche the user will be tagged as active
-
resendEmailConfirmation
public void resendEmailConfirmation(java.lang.String email, ListenerModel<BaseModel<Message>,Message> listener)
-
getMemberId
public java.lang.String getMemberId()
-
saveMemberId
public void saveMemberId(java.lang.String memberId)
-
clearMemberId
public void clearMemberId()
-
-