-
Notifications
You must be signed in to change notification settings - Fork 1
Release Notes
This document includes a change log for the lia-core
module.
Version 1.3.0 of the Khoros Community Android SDK includes major updates and enhancements. Major changes include:
-
A new repository located here. We consolidated the three original the SDK repositories (core, ui, and example) into a single location.
-
A new root package name (
lithium.community.android.sdk
tocom.lithium.community.android
) -
Better exception handling for REST API responses
-
Improved Javadoc documentation
-
Reduced SDK size
-
Improved initialization flow
-
Better API performance
-
Fixed crashes and bugs in the UI Support Library
-
Improved the usability of the demo application
-
Changed the variable names to make them more meaningful - Initialization now looks like this:
try { LiAppCredentials credentials = new LiAppCredentials( getString(R.string.clientName), getString(R.string.clientId), getString(R.string.clientSecret), getString(R.string.tenantId), getString(R.string.communityUrl), getInstanceId(this) ); LiSDKManager.init(this, liAppCredentials); } catch (MalformedURLException | URISyntaxException | IllegalArgumentException e) { Log.e(LOG_TAG, "Couldn't initialize Lithium SDK"); }
Define the name in
/res/values/strings
.<string name="clientId">PLACE YOUR COMMUNITY CLIENT ID HERE</string> <string name="clientSecret">PLACE YOUR COMMUNITY CLIENT SECRET HERE</string> <string name="communityUrl">PLACE YOUR COMMUNITY URL HERE</string> <string name="tenantId">PLACE COMMUNITY TENANT ID HERE</string> <string name="clientName">PLACE CLIENT APP NAME HERE</string>
New methods
-
initialize(Context, LiAppCredentials): void
Initializes the SDK. If the initialization is successful
getInstance()
will return an initialized SDK Manager. This function may or may not create a new instance or reinitialize the SDK Manager with subsequent calls. Replacesinit(Context, LiAppCredentials): LiSDKManager
. -
isInitialized(): boolean
Used to check whether the SDK is initialized correctly. Use this before invoking the core SDK APIs and components that depend on initialization. Returns
true
if the SDK is fully initialized, otherwisefalse
. ReplacesisEnvironmentInitialized(): boolean
.
Deprecated methods
-
LiSDKManager
init(Context, LiAppCredentials): LiSDKManager
isEnvironmentInitialized(): boolean
getCoreSDKVersion(): String
getApiGatewayHost(): String
getCommunityUrl(): String
getLiAppCredentials(): LiAppCredentials
getNewAuthToken(): String
getProxyHost(): String
getTenant(): String
-
LiAppCredentials
getApiProxyHost(): String
getClientAppName(): String
-
LiAppCredentials.Builder
-
We have decoupled SDK initialization from synching the Android app with the Community server. Previously, the app synched with Community as part of
LiSDKManager init(android.content.Context context, LiAppCredentials liAppCredentials)
.As of 1.2.5, you now sync the app with the community after initialization but before making any Community REST API calls using
LiSDKManager.getInstance().syncWithCommunity(context Context)
either directly after initialization or in a different part of the app.To sync the app, make the following call:
LiSDKManager.getInstance().syncWithCommunity(this);
-
Device token ID for notification registration now passed when initiating the login flow
Prior to 1.2.0, the SDK supported subscription notifications only through Firebase Cloud Messaging. We now enable customers to use other subscription notification services if desired. To use Lithium and Firebase for subscription notifications, developers now register a device for notification when initiating the login flow. Customers not using Firebase do not pass a device token. See details in Authenticating a user.
-
New parameter constructor for
LiPostSubscriptionParams
We added a second constructor to build parameters passed to the
getSubscriptionPostClient(LiClientRequestParams liClientRequestParams)
provider. Our original constructor requiredLiBaseModel
, which is not always available. Our new constructor takes the subscription target ID and type. See details in Javadoc for LiClientRequestParams.LiPostSubscriptionParams for complete details.
-
Set the client app name during initialization.
You now set the Client App Name during initialization. Pass the Display Name defined for the app in the Display Name field in the Community Admin > System > API Apps tab. If you do not pass the Client App Name during initialization, it defaults to communityId-sdk.
Initialization now looks like this:
try { LiAppCredentials liAppCredentials = new LiAppCredentials.Builder() .setClientKey(getString(R.string.clientId)) .setClientSecret(getString(R.string.clientSecret)) .setCommunityUri(getString(R.string.communityURL)) .setTenantId(getString(R.string.communityTenantId)) .setApiProxyHost(getString(R.string.apiProxyHostname)) .setClientAppName(getString(R.string.clientAppName) .build(); LiSDKManager.init(this, liAppCredentials); } catch (MalformedURLException | URISyntaxException | IllegalArgumentException e) { Log.e(LOG_TAG, "Couldn't initialize Lithium SDK"); }
Define the name in
/res/values/strings
.<string name="clientId">PLACE YOUR COMMUNITY CLIENT ID HERE</string> <string name="clientSecret">PLACE YOUR COMMUNITY CLIENT SECRET HERE</string> <string name="communityURL">PLACE YOUR COMMUNITY URL HERE</string> <string name="communityTenantId">PLACE COMMUNITY TENANT ID HERE</string> <string name="clientAppName">PLACE CLIENT APP NAME HERE</string>
Minor bug fixes and UI changes
- Customer delete provider
We added a new API provider to perform custom Delete actions
getGenericQueryDeleteClient(LiClientRequestParams liClientRequestParams)
For details, see the Creating custom API providers section in API reference.
-
Anonymous browsing support
We now allow anonymous browsing via the Android SDK. If the action called cannot be performed by an anonymous user, the SDK returns a 401 error (Unauthorized). See Authentication with the Community Android SDK for an example for handling a 401 error.
-
Changes to initialization
We have changed how to initialize the core SDK. To support anonymous browsing, you now set the tenant ID and API proxy host with
LiAppCredentials
.try { LiAppCredentials liAppCredentials = new LiAppCredentials.Builder() .setClientKey(getString(R.string.clientId)) .setClientSecret(getString(R.string.clientSecret)) .setCommunityUri(getString(R.string.communityURL)) .setTenantId(getString(R.string.communityTenantId)) .setApiProxyHost(getString(R.string.apiProxyHostname)).build(); LiSDKManager.init(this, liAppCredentials); } catch (MalformedURLException | URISyntaxException | IllegalArgumentException e) { Log.e(LOG_TAG, "Couldn't initialize Lithium SDK"); }
The builder pulls the tenant ID and host name from strings.xml. Set the the ID and name in /res/values/strings.xml like this:
<string name="communityTenantId">PLACE COMMUNITY TENANT ID HERE</string> <string name="apiProxyHostname">PLACE API PROXY HOSTNAME HERE</string>
You can find your tenant ID and API proxy hostname in Community Admin > System > API Apps.
-
Changes to how we build a client
We have changed how we build a client request. Previously you passed raw parameters to our provider clients. For example:
getMessagesCilent(final String boardId)
.Starting with 1.10, you will pass parameters using the
LiClientRequestParams
class.In addition, we previously saved the Android context when the app was booted. To prevent stale context, as of 1.1.0, you’ll send the Android context whenever you build the client for a specific request. There is a specific call for each provider to get the context.
Example: Get the latest messages from the community
LiClientRequestParams liClientRequestParams = new LiClientRequestParams.LiMessagesClientRequestParams(getContext()); LiClient client = LiClientManager.getMessagesClient(liClientRequestParams);
Example: Get the latest messages from a particular board
LiClientRequestParams liClientRequestParams = new LiClientRequestParams.LiMessagesByBoardIdClientRequestParams(getContext(), selectedBoardId); LiClient client = LiClientManager.getMessagesByBoardIdClient(liClientRequestParams);
-
New utility methods
We’ve added new utility methods:
-
LiSDKManager.getInstance().isUserLoggedIn()
- determines whether the user is logged in or not -
LiSDKManager.isEnvironmentInitialized()
-determines whether the SDK is initialized
-
-
New providers
We’ve added the following providers to LiClientManager:
-
getSubscriptionPostClient(LiClientRequestParams liClientRequestParams)
- subscribe to a message -
getMarkMessagePostClient(LiClientRequestParams liClientRequestParams)
- mark a single message as read or unread -
getMarkMessagesPostClient(LiClientRequestParams liClientRequestParams)
- mark multiple messages as read or unread -
getMarkTopicPostClient(LiClientRequestParams liClientRequestParams)
- mark a topic message and all of its replies as read or unread -
getCreateUserClient(LiClientRequestParams liClientRequestParams)
- create a new user -
getUpdateUserClient(LiClientRequestParams liClientRequestParams)
- update a user account -
getGenericPutClient(LiClientRequestParams liClientRequestParams)
- new generic provider for PUT actions. UseLiGenericPutClientRequestParams(Context context, String path, JsonObject requestBody)
to create the parameters
-
-
Renamed providers We have renamed several providers for consistency.
-
createGenericPostClient(String path, JsonObject responseBody)
is nowgetGenericPostClient(LiClientRequestParams liClientRequestParams)
-
- New API provider: getMarkAbuseClient(String messageId, String userId, String body)
- Changes to the authentication flow
- You no longer pass the SSO token to the
LiAppCredentials
builder during authentication - You no longer use
setDeferredLogin
theLiAppCredentials
builder during authentication
- You no longer pass the SSO token to the
- Changes to starting the login flow without using the UI module (lia-ui). See Authentication-with-the-Community-Android-SDK for example.
- Removed the
allowBackup
attribute from package manifest (AndroidManifest.xml)