public final class GetSocial
extends java.lang.Object
Modifier and Type | Class and Description |
---|---|
static class |
GetSocial.Device |
Modifier and Type | Method and Description |
---|---|
static java.lang.String |
addOnCurrentUserChangedListener(OnCurrentUserChangedListener listener)
Add listener to be notified when the user was changed.
|
static void |
addOnInitializeListener(java.lang.Runnable action)
Set an action, which should be executed after SDK initialized.
|
static CurrentUser |
getCurrentUser()
Current user.
|
static java.lang.String |
getLanguage() |
static java.lang.String |
getSdkVersion()
The version of GetSocial SDK.
|
static void |
init()
Init the SDK.
|
static void |
init(java.lang.String appId)
Init the SDK.
|
static boolean |
isInitialized()
Provides the status of the GetSocial initialisation.
|
static void |
processAction(Action action)
Process action with default GetSocial behaviour.
|
static void |
removeOnUserChangedListener(java.lang.String listenerId)
Remove listener with id.
|
static void |
resetUser(CompletionCallback callback,
FailureCallback failure)
Reset current user and create a new anonymous one.
|
static boolean |
setLanguage(java.lang.String languageCode)
Set the language of GetSocial SDK.
|
static void |
switchUser(Identity identity,
CompletionCallback callback,
FailureCallback failure)
Switches the current user with the
User corresponding to the details provided. |
public static java.lang.String addOnCurrentUserChangedListener(OnCurrentUserChangedListener listener)
OnCurrentUserChangedListener.onUserChanged(CurrentUser)
method.
Listener will be invoked when:
- SDK initialization is finished;
- switchUser(im.getsocial.sdk.communities.Identity, im.getsocial.sdk.CompletionCallback, im.getsocial.sdk.FailureCallback)
method was called and user was successfully changed.listener
- Listener to be notified.removeOnUserChangedListener(String)
.public static void removeOnUserChangedListener(java.lang.String listenerId)
listenerId
- ID of listener you want to remove. It should be the string returned by addOnCurrentUserChangedListener(OnCurrentUserChangedListener)
public static CurrentUser getCurrentUser()
public static void switchUser(Identity identity, CompletionCallback callback, FailureCallback failure)
User
corresponding to the details provided.identity
- Identity to be switched to.callback
- A callback to indicate if this operation was successful.failure
- Called if operation failed.public static void resetUser(CompletionCallback callback, FailureCallback failure)
callback
- called if successfully reset user.failure
- called if operation failed.public static java.lang.String getSdkVersion()
String
value of the SDK version.public static void init()
addOnInitializeListener(Runnable)
to be notified when SDK is initialized.
GetSocial App Id will be taken from AndroidManifest.xml metadata.public static void init(java.lang.String appId)
addOnInitializeListener(Runnable)
to be notified when SDK is initialized.appId
- GetSocial App Id. You can find your App Id on the GetSocial Dashboard.public static void addOnInitializeListener(java.lang.Runnable action)
action
- Action to execute.public static boolean isInitialized()
public static java.lang.String getLanguage()
LanguageCodes
, or default language in case of failure.public static boolean setLanguage(java.lang.String languageCode)
languageCode
- Must be one of language codes provided in LanguageCodes
public static void processAction(Action action)
action
- action to be processed.(c) Copyright GetSocial BV, 2020. All Rights Reserved.