Connect Android SDK: initialization and configuration
The page describes the primary methods that you can use to manage and configure the Connect Android SDK.
Platform: Android 8-16
Languages: Kotlin and Java
Declared in: Connect
Library management
Connect.init
Connect.initInitializes the Connect library.
Connect.init(application: Application)Parameters:
application(required) — the AndroidApplicationinstance. Call this beforeConnect.enable().
Connect.enable
Connect.enableEnables the Connect library.
Connect.enable(appKey: String?, postMessageUrl: String?)Parameters:
appKey(required) — the application key generated for your mobile app. Ifnull, the value is read fromConnectBasicConfig.properties.postMessageUrl(required) — the Connect domain assigned to your organization. Ifnull, the value is read fromConnectBasicConfig.properties.
Connect.disable
Connect.disableDisables the Connect library.
Connect.disable(): BooleanConnect.isEnabled
Connect.isEnabledCheck if the Connect library is enabled.
Connect.isEnabled(): BooleanConnect.getLibraryVersion
Connect.getLibraryVersionReturns the library version.
Connect.getLibraryVersion(): StringConnect.push
Connect.pushReturns the push notification API.
Connect.push: PushApiUse this property to access push notification methods such as isPushAccepted(). See Enable push notifications in an Android app (Firebase) or Enable push notifications in an Android app (Huawei).
Session management
Connect.startSession
Connect.startSessionStarts a new Connect session.
Connect.startSession(sessionID: String?): BooleanParameters:
sessionID(optional) — the ID to assign to the session.
Connect.getCurrentSessionId
Connect.getCurrentSessionIdReturns the ID of the current session.
Connect.getCurrentSessionId(): StringConnect.setCurrentSessionId
Connect.setCurrentSessionIdSets the current session ID.
Connect.setCurrentSessionId(sessionId: String?)Parameters:
sessionId(required) — the ID to assign to the current Connect session.
Connect.createSessionId
Connect.createSessionIdCreates a new session ID.
Connect.createSessionId(): String?Connect.getTimestampFromSession
Connect.getTimestampFromSessionReturns the timestamp of the current session.
Connect.getTimestampFromSession(): LongIdentification
Connect.logIdentificationEvent
Connect.logIdentificationEventSends an identification signal to Connect.
Connect.logIdentificationEvent(
identifierName: String,
identifierValue: String,
url: String = "http://acoustic.co/test",
signalType: String = "pageView",
additionalParameters: Map<String, String> = emptyMap()
): BooleanParameters:
identifierName(required) — the contact attribute name in Connect. Must match exactly, including capitalization and spacing.identifierValue(required) — the value of the identifier.url(optional) — the screen context for the signal. Defaults to"http://acoustic.co/test".signalType(required) — the signal type. Pass"loggedIn"for sign-in events or"accountRegistered"for registration events.additionalParameters(optional) — additional key-value pairs to include with the signal.
Returns false without throwing if either identifierName or identifierValue is blank.
Property and device management
Connect.getPropertyName
Connect.getPropertyNameReturns the property name from a view.
Connect.getPropertyName(view: View?): PropertyNameConnect.getDeviceId
Connect.getDeviceIdReturns the device ID.
Connect.getDeviceId(): StringConnect.setDeviceId
Connect.setDeviceIdSets the device ID.
Connect.setDeviceId(deviceId: String?): BooleanConfig management
Connect.getConfigItemInt
Connect.getConfigItemIntReturns an integer config item.
Connect.getConfigItemInt(
key: String,
module: EOLifecycleObjectName
): IntConnect.getConfigItemLong
Connect.getConfigItemLongReturns a long integer config item.
Connect.getConfigItemLong(
key: String,
module: EOLifecycleObjectName
): LongConnect.getConfigItemDouble
Connect.getConfigItemDoubleReturns a double config item.
Connect.getConfigItemDouble(
key: String,
module: EOLifecycleObjectName
): DoubleConnect.getConfigItemBoolean
Connect.getConfigItemBooleanReturns a boolean config item.
Connect.getConfigItemBoolean(
key: String,
module: EOLifecycleObjectName
): BooleanConnect.getConfigItemString
Connect.getConfigItemStringReturns a string config item.
Connect.getConfigItemString(
key: String,
module: EOLifecycleObjectName
): String?Connect.getConfigItemLongMSFromMinute
Connect.getConfigItemLongMSFromMinuteReturns a long integer value in milliseconds from minutes.
Connect.getConfigItemLongMSFromMinute(
key: String,
module: EOLifecycleObjectName
): LongConnect.updateConfig
Connect.updateConfigUpdates a configuration item.
Connect.updateConfig(
key: String,
value: String,
module: EOLifecycleObjectName
): BooleanConnect.getConfig
Connect.getConfigReturns the configuration for a module.
Connect.getConfig(
module: EOLifecycleObjectName
): Map<String, String>?Connect.appendConfig
Connect.appendConfigAppends configuration from a file.
Connect.appendConfig(
module: EOLifecycleObjectName,
fileName: String
): BooleanConnect.updateConfig (JSONObject overload)
Connect.updateConfig (JSONObject overload)Updates configuration using a JSONObject.
Connect.updateConfig(
module: EOLifecycleObjectName,
configurationObject: JSONObject
): BooleanLifecycle object management
Connect.getLifecycleObject
Connect.getLifecycleObjectReturns a lifecycle object by name.
Connect.getLifecycleObject(name: String): EOLifecycleObject?Environmental Data Service
Connect.getEnvironmentalDataService
Connect.getEnvironmentalDataServiceReturns the environmental data service.
Connect.getEnvironmentalDataService(): EnvironmentalDataService?Updated 13 days ago
