Package com.cheetahdigital.corekit.sdk
Class Sdk
- java.lang.Object
-
- com.cheetahdigital.corekit.sdk.Sdk
-
public final class Sdk extends java.lang.Object
Contains all the basic api calls in the core kit
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static interface
Sdk.LogoutListener
-
Field Summary
Fields Modifier and Type Field Description static java.lang.String
MEMBER_ID_KEY
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description void
clearMemberId()
java.lang.String
getAccessToken()
Get the currently stored Loyalty API Access TokenAuthenticatorService
getAuthenticatorService()
java.lang.String
getClientId()
java.lang.String
getClientSecret()
java.lang.String
getClientUrl()
android.content.Context
getContext()
Get the application contextstatic Sdk
getInstance()
java.lang.String
getMemberId()
java.lang.String
getRefreshToken()
Get the currently stored Loyalty API Refresh TokenSdkConfig
getSdkConfig()
static void
initialize(android.app.Application application)
Initialize the SDKstatic void
initialize(android.app.Application application, SdkConfig sdkConfig)
Initialize the SDK using the givenEndpoint
.static boolean
isInitialized()
Indicated whether the Android Core SDK is initialized.boolean
isLoggedIn()
Check if a member is currently Logged in via SDK.boolean
isSendLocationAnonymously()
Flag for checking if sending of location anonymously is allowedboolean
isThirdPartyAuth()
Returns a boolean which indicates if the authentication was made by a third party authenticator.boolean
isTokenExpired()
Check if the stored Loyalty API Access Token is already expired.void
login(java.lang.String jwToken)
Login via java web tokenvoid
logout()
Log out the current user.void
refreshToken()
Refresh the currently stored Loyalty API Access Token.void
resendEmailConfirmation(java.lang.String email, ListenerModel<BaseModel<Message>,Message> listener)
void
saveMemberId(java.lang.String memberId)
void
setRequireResetPassword(boolean value)
Set the flag that indicates whether user should reset passwordvoid
setSendLocationAnonymously(boolean isEnabled)
Sets the flag that indicates whether sending of location anonymously is allowedboolean
shouldRequireResetPassword()
Flag for checking if the user should reset the passwordvoid
trackAppUsage()
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 AndroidApplication
sdkConfig
- 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
Application
instance
-
isThirdPartyAuth
public boolean isThirdPartyAuth()
Returns a boolean which indicates if the authentication was made by a third party authenticator.- Returns:
true
if authentication is from third partyfalse
if 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
Application
instance
-
getClientId
public java.lang.String getClientId()
- Returns:
- client id which is currently stored in your
Application
instance
-
getClientUrl
public java.lang.String getClientUrl()
- Returns:
- client url which is currently stored in your
Application
instance
-
getClientSecret
public java.lang.String getClientSecret()
- Returns:
- client secret which is currently stored in your
Application
instance
-
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()
-
-