Class MobileCore
-
- All Implemented Interfaces:
public final class MobileCore
-
-
Method Summary
Modifier and Type Method Description static voidinitialize(@NonNull() Application application, @NonNull() InitOptions initOptions, @Nullable() AdobeCallback<out Object> completionCallback)Initializes the AEP SDK with the specified InitOptions. static voidinitialize(@NonNull() Application application, @NonNull() String appId, @Nullable() AdobeCallback<out Object> completionCallback)Convenience overload that initializes the AEP SDK with bundled extensions, automatic lifecycle tracking, and configures the SDK using the specified application ID via configureWithAppID. static voidinitialize(@NonNull() Application application, @NonNull() String appId)Convenience overload that initializes the AEP SDK with bundled extensions, automatic lifecycle tracking, and configures the SDK using the specified application ID via configureWithAppID. static StringextensionVersion()Returns the version for the MobileCoreextensionstatic voidsetWrapperType(@NonNull() WrapperType wrapperType)Sets the SDK's current wrapper type. static voidsetApplication(@NonNull() Application application)Set the Android Application, which enables the SDK get the app Context, register a ActivityLifecycleCallbacks to monitor the lifecycle of the app and get the Activity on top of the screen.static ApplicationgetApplication()Get the global Application object of the current process. static voidsetLogLevel(@NonNull() LoggingMode mode)Set the LoggingMode level for the Mobile SDK. static LoggingModegetLogLevel()Get the LoggingMode level for the Mobile SDK static voidregisterExtensions(@NonNull() List<Class<out Extension>> extensions, @Nullable() AdobeCallback<out Object> completionCallback)Registers all extensions with Core and starts event processing. static voidregisterEventListener(@NonNull() String eventType, @NonNull() String eventSource, @NonNull() AdobeCallback<Event> callback)Registers an event listener for the provided event type and source. static voiddispatchEvent(@NonNull() Event event)This method will dispatch the provided Eventto dispatch an event for other extensions or the internal SDK to consume.static voiddispatchEventWithResponseCallback(@NonNull() Event event, long timeoutMS, @NonNull() AdobeCallbackWithError<Event> responseCallback)This method will be used when the provided Eventis used as a trigger and a response event is expected in return.static voidsetSmallIconResourceID(int resourceID)Sets the resource Id for small icon. static intgetSmallIconResourceID()Returns the resource Id for small icon if it was set by `setSmallIconResourceID`. static voidsetLargeIconResourceID(int resourceID)Sets the resource Id for large icon. static intgetLargeIconResourceID()Returns the resource Id for large icon if it was set by `setLargeIconResourceID`. static voidsetAdvertisingIdentifier(@Nullable() String advertisingIdentifier)This method dispatches an event to notify the SDK of a new advertisingIdentifierstatic voidsetPushIdentifier(@Nullable() String pushIdentifier)This method dispatches an event to notify the SDK of a new pushIdentifierstatic voidcollectPii(@NonNull() Map<String, String> data)Collect PII data. static voidcollectMessageInfo(@NonNull() Map<String, Object> messageInfo)Collects message data from various points in the application. static voidconfigureWithAppID(@NonNull() String appId)Configure the SDK by downloading the remote configuration file hosted on Adobe servers specified by the given application ID. static voidconfigureWithFileInAssets(@NonNull() String fileName)Load configuration from the file in the assets folder. static voidconfigureWithFileInPath(@NonNull() String filePath)Load configuration from local file. static voidupdateConfiguration(@NonNull() Map<String, Object> configMap)Update specific configuration parameters. static voidclearUpdatedConfiguration()Clear the changes made by updateConfiguration and setPrivacyStatus to the initial configuration provided either by configureWithAppID or configureWithFileInPath or configureWithFileInAssets static voidsetPrivacyStatus(@NonNull() MobilePrivacyStatus privacyStatus)Set the Adobe Mobile Privacy status. static voidgetPrivacyStatus(AdobeCallback<MobilePrivacyStatus> callback)Get the current Adobe Mobile Privacy Status. static voidgetSdkIdentities(@NonNull() AdobeCallback<String> callback)Retrieve all identities stored by/known to the SDK in a JSON Stringformat.static voidresetIdentities()Clears all identifiers from Edge extensions and generates a new Experience Cloud ID (ECID). static voidlifecycleStart(@Nullable() Map<String, String> additionalContextData)Start/resume lifecycle session. static voidlifecyclePause()Pause/stop lifecycle session. static voidtrackAction(@NonNull() String action, @Nullable() Map<String, String> contextData)This method dispatches an Analytics track actionevent Actions represent events that occur in your application that you want to measure; the corresponding metrics will be incremented each time the event occurs.static voidtrackState(@NonNull() String state, @Nullable() Map<String, String> contextData)This method dispatches an Analytics track stateevent States represent different screens or views of your application.-
-
Method Detail
-
initialize
static void initialize(@NonNull() Application application, @NonNull() InitOptions initOptions, @Nullable() AdobeCallback<out Object> completionCallback)
Initializes the AEP SDK with the specified InitOptions. This automatically registers all bundled extensions and sets up lifecycle tracking. You can disable automatic lifecycle tracking using InitOptions.
- Parameters:
application- The Android Application instance.initOptions- The InitOptions to configure the SDK.completionCallback- An optional AdobeCallback triggered once initialization is complete.
-
initialize
static void initialize(@NonNull() Application application, @NonNull() String appId, @Nullable() AdobeCallback<out Object> completionCallback)
Convenience overload that initializes the AEP SDK with bundled extensions, automatic lifecycle tracking, and configures the SDK using the specified application ID via configureWithAppID. An optional completion callback is invoked once initialization is complete.
- Parameters:
application- The Android Application instance.appId- A unique identifier assigned to the app instance by Adobe tags.completionCallback- An optional callback triggered once initialization is complete.
-
initialize
static void initialize(@NonNull() Application application, @NonNull() String appId)
Convenience overload that initializes the AEP SDK with bundled extensions, automatic lifecycle tracking, and configures the SDK using the specified application ID via configureWithAppID.
- Parameters:
application- The Android Application instance.appId- A unique identifier assigned to the app instance by Adobe tags.
-
extensionVersion
@NonNull() static String extensionVersion()
Returns the version for the
MobileCoreextension- Returns:
The version string
-
setWrapperType
static void setWrapperType(@NonNull() WrapperType wrapperType)
Sets the SDK's current wrapper type. This API should only be used if being developed on platforms such as React Native or Flutter
- Parameters:
wrapperType- the type of wrapper being used.
-
setApplication
static void setApplication(@NonNull() Application application)
Set the Android Application, which enables the SDK get the app
Context, register a ActivityLifecycleCallbacks to monitor the lifecycle of the app and get the Activity on top of the screen.NOTE: This method should be called right after the app starts, so it gives the SDK all the contexts it needed.
- Parameters:
application- the Android Application instance.
-
getApplication
@Nullable() static Application getApplication()
Get the global Application object of the current process.
NOTE: setApplication must be called before calling this method.
- Returns:
the current
Application, or null if noApplicationwas set or theApplicationprocess was destroyed.
-
setLogLevel
static void setLogLevel(@NonNull() LoggingMode mode)
Set the LoggingMode level for the Mobile SDK.
- Parameters:
mode- the logging mode.
-
getLogLevel
@NonNull() static LoggingMode getLogLevel()
Get the LoggingMode level for the Mobile SDK
- Returns:
the set
LoggingMode
-
registerExtensions
static void registerExtensions(@NonNull() List<Class<out Extension>> extensions, @Nullable() AdobeCallback<out Object> completionCallback)
Registers all extensions with Core and starts event processing.
This method needs to be called after setApplication is called.
- Parameters:
extensions- List of extension classes whose parent is Extension.completionCallback- an optional AdobeCallback invoked after registrations are completed
-
registerEventListener
static void registerEventListener(@NonNull() String eventType, @NonNull() String eventSource, @NonNull() AdobeCallback<Event> callback)
Registers an event listener for the provided event type and source.
- Parameters:
eventType- the event type as a valid string.eventSource- the event source as a valid string.callback- the callback whose call will be called when the event is heard.
-
dispatchEvent
static void dispatchEvent(@NonNull() Event event)
This method will dispatch the provided
Eventto dispatch an event for other extensions or the internal SDK to consume.- Parameters:
event- the Event to be dispatched.
-
dispatchEventWithResponseCallback
static void dispatchEventWithResponseCallback(@NonNull() Event event, long timeoutMS, @NonNull() AdobeCallbackWithError<Event> responseCallback)
This method will be used when the provided
Eventis used as a trigger and a response event is expected in return.Passes an UNEXPECTED_ERROR to fail if
eventis null. Passes an CALLBACK_TIMEOUT to fail ifeventprocessing timeout occurs.
-
setSmallIconResourceID
static void setSmallIconResourceID(int resourceID)
Sets the resource Id for small icon.
- Parameters:
resourceID- the resource Id of the icon
-
getSmallIconResourceID
static int getSmallIconResourceID()
Returns the resource Id for small icon if it was set by `setSmallIconResourceID`.
- Returns:
a `int` value if it has been set, otherwise -1
-
setLargeIconResourceID
static void setLargeIconResourceID(int resourceID)
Sets the resource Id for large icon.
- Parameters:
resourceID- the resource Id of the icon
-
getLargeIconResourceID
static int getLargeIconResourceID()
Returns the resource Id for large icon if it was set by `setLargeIconResourceID`.
- Returns:
a `int` value if it has been set, otherwise -1
-
setAdvertisingIdentifier
static void setAdvertisingIdentifier(@Nullable() String advertisingIdentifier)
This method dispatches an event to notify the SDK of a new
advertisingIdentifier- Parameters:
advertisingIdentifier-Stringrepresenting Android advertising identifier
-
setPushIdentifier
static void setPushIdentifier(@Nullable() String pushIdentifier)
This method dispatches an event to notify the SDK of a new
pushIdentifier- Parameters:
pushIdentifier-Stringrepresenting the new push identifier
-
collectPii
static void collectPii(@NonNull() Map<String, String> data)
Collect PII data. Although using this call enables collection of PII data, the SDK does not automatically send the data to any Adobe endpoint.
- Parameters:
data- the map containing the PII data to be collected.
-
collectMessageInfo
static void collectMessageInfo(@NonNull() Map<String, Object> messageInfo)
Collects message data from various points in the application.
This method can be invoked to support the following use cases:
- Tracking Push Message receive and click.
- Tracking Local Notification receive and click.
The message tracking information can be supplied in the
messageInfoMap. For scenarios where the application is launched as a result of notification click, collectLaunchInfo will be invoked with the target Activity and message data will be extracted from the Intent extras.- Parameters:
messageInfo-Map<String, Object>containing message tracking information.
-
configureWithAppID
static void configureWithAppID(@NonNull() String appId)
Configure the SDK by downloading the remote configuration file hosted on Adobe servers specified by the given application ID.
The configuration file is cached once downloaded and used in subsequent calls to this API. If the remote file is updated after the first download, the updated file is downloaded and replaces the cached file.
- Parameters:
appId- A unique identifier assigned to the app instance by Adobe Tags.
-
configureWithFileInAssets
static void configureWithFileInAssets(@NonNull() String fileName)
Load configuration from the file in the assets folder. SDK automatically reads config from `ADBMobileConfig.json` file if it exists in the assets folder. Use this API only if the config needs to be read from a different file.
On application relaunch, the configuration from the file at
filepathis not preserved and this method must be called again if desired.On failure to read the file or parse the JSON contents, the existing configuration remains unchanged.
Calls to this API will replace any existing SDK configuration except those set using updateConfiguration or setPrivacyStatus. Configuration updates made using updateConfiguration and setPrivacyStatus are always applied on top of configuration changes made using this API.
- Parameters:
fileName- the name of the configure file in the assets folder.
-
configureWithFileInPath
static void configureWithFileInPath(@NonNull() String filePath)
Load configuration from local file.
Configure the SDK by reading a local file containing the JSON configuration. On application relaunch, the configuration from the file at
filepathis not preserved and this method must be called again if desired.On failure to read the file or parse the JSON contents, the existing configuration remains unchanged.
Calls to this API will replace any existing SDK configuration except those set using updateConfiguration or setPrivacyStatus. Configuration updates made using updateConfiguration and setPrivacyStatus are always applied on top of configuration changes made using this API.
- Parameters:
filePath- absolute path to a local configuration file.
-
updateConfiguration
static void updateConfiguration(@NonNull() Map<String, Object> configMap)
Update specific configuration parameters.
Update the current SDK configuration with specific key/value pairs. Keys not found in the current configuration are added. Configuration updates are preserved and applied over existing or new configurations set by calling configureWithAppID or configureWithFileInPath, even across application restarts.
Using
nullvalues is allowed and effectively removes the configuration parameter from the current configuration.- Parameters:
configMap- configuration key/value pairs to be updated or added.
-
clearUpdatedConfiguration
static void clearUpdatedConfiguration()
Clear the changes made by updateConfiguration and setPrivacyStatus to the initial configuration provided either by configureWithAppID or configureWithFileInPath or configureWithFileInAssets
-
setPrivacyStatus
static void setPrivacyStatus(@NonNull() MobilePrivacyStatus privacyStatus)
Set the Adobe Mobile Privacy status.
Sets the MobilePrivacyStatus for this SDK. The set privacy status is preserved and applied over any new configuration changes from calls to configureWithAppID or configureWithFileInPath, even across application restarts.
- Parameters:
privacyStatus- MobilePrivacyStatus to be set to the SDK
-
getPrivacyStatus
static void getPrivacyStatus(AdobeCallback<MobilePrivacyStatus> callback)
Get the current Adobe Mobile Privacy Status.
Gets the currently configured MobilePrivacyStatus and passes it as a parameter to the given call function.
- Parameters:
callback- AdobeCallback instance which is invoked with the configured privacy status as a parameter.
-
getSdkIdentities
static void getSdkIdentities(@NonNull() AdobeCallback<String> callback)
Retrieve all identities stored by/known to the SDK in a JSON
Stringformat.- Parameters:
callback- AdobeCallback instance which is invoked with all the known identifier in JSON String format.
-
resetIdentities
static void resetIdentities()
Clears all identifiers from Edge extensions and generates a new Experience Cloud ID (ECID).
-
lifecycleStart
static void lifecycleStart(@Nullable() Map<String, String> additionalContextData)
Start/resume lifecycle session.
Start a new lifecycle session or resume a previously paused lifecycle session. If a previously paused session timed out, then a new session is created. If a current session is running, then calling this method does nothing.
Additional context data may be passed when calling this method. Lifecycle data and any additional data are sent as context data parameters to Analytics, to Target as mbox parameters, and for Audience Manager they are sent as customer variables. Any additional data is also used by the Rules Engine when processing rules.
This method should be called from the Activity onResume method.
- Parameters:
additionalContextData- optional additional context for this session.
-
lifecyclePause
static void lifecyclePause()
Pause/stop lifecycle session.
Pauses the current lifecycle session. Calling pause on an already paused session updates the paused timestamp, having the effect of resetting the session timeout timer. If no lifecycle session is running, then calling this method does nothing.
A paused session is resumed if lifecycleStart is called before the session timeout. After the session timeout, a paused session is closed and calling lifecycleStart will create a new session. The session timeout is defined by the
lifecycle.sessionTimeoutconfiguration parameter. If not defined, the default session timeout is five minutes.This method should be called from the Activity onPause method.
-
trackAction
static void trackAction(@NonNull() String action, @Nullable() Map<String, String> contextData)
This method dispatches an Analytics track
actioneventActions represent events that occur in your application that you want to measure; the corresponding metrics will be incremented each time the event occurs. For example, you may want to track when an user click on the login button or a certain article was viewed.
- Parameters:
action-Stringcontaining the name of the action to trackcontextData-Map<String, String>containing context data to attach on this hit
-
trackState
static void trackState(@NonNull() String state, @Nullable() Map<String, String> contextData)
This method dispatches an Analytics track
stateeventStates represent different screens or views of your application. When the user navigates between application pages, a new track call should be sent with current state name. Tracking state name is typically called from an Activity in the onResume method.
- Parameters:
state-Stringcontaining the name of the state to track.contextData- optional contextDataMap<String, String>containing context data to attach on this hit
-
-
-
-