-
- All Implemented Interfaces:
public final class MobileCore
-
-
Method Summary
Modifier and Type Method Description 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 Application.ActivityLifecycleCallbacks to monitor the lifecycle of the app and get the android.app.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 void)>registerExtensions(@NonNull() List<Class<out Extension>> extensions, @Nullable() AdobeCallback<?> completionCallback)Registers all extensions with Core and starts event processing. static void)>registerEventListener(@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 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.static voidsetSmallIconResourceID(int resourceID)Sets the resource Id for small icon. static voidsetLargeIconResourceID(int resourceID)Sets the resource Id for small icon. 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 void)>getPrivacyStatus(AdobeCallback<MobilePrivacyStatus> callback)Get the current Adobe Mobile Privacy Status. static void)>getSdkIdentities(@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.static MessagingDelegategetMessagingDelegate()Gets a previously set Message delegate. static voidsetMessagingDelegate(@Nullable() MessagingDelegate messagingDelegate)Sets a Message delegate used to listen for current message lifecycle events. static voidlog(@NonNull() LoggingMode mode, String tag, String message)Sends a log message of the given LoggingMode.static boolean)>registerExtension(@NonNull() Class<out Extension> extensionClass, @Nullable() ExtensionErrorCallback<ExtensionError> errorCallback)Registers an extension class which has Extensionas parent.static void)>start(@Nullable() AdobeCallback<?> completionCallback)Start the Core processing. static void)>dispatchEventWithResponseCallback(@NonNull() Event event, @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 boolean)>dispatchEvent(@NonNull() Event event, @Nullable() ExtensionErrorCallback<ExtensionError> errorCallback)Called by the extension public API to dispatch an event for other extensions or the internal SDK to consume. static boolean,ExtensionErrorCallback)>dispatchEventWithResponseCallback (@NonNull() Event event, @NonNull() AdobeCallback<Event> responseCallback, @Nullable() ExtensionErrorCallback<ExtensionError> errorCallback)This method will be used when the provided Eventis used as a trigger and a response event is expected in return.static boolean)>dispatchResponseEvent(@NonNull() Event responseEvent, @NonNull() Event requestEvent, @Nullable() ExtensionErrorCallback<ExtensionError> errorCallback)Dispatches a response event for a paired event that was sent to dispatchEventWithResponseCallbackand received by an extension listenerhearmethod.-
-
Method Detail
-
extensionVersion
@NonNull() static String extensionVersion()
Returns the version for the
MobileCoreextension
-
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 Application.ActivityLifecycleCallbacks to monitor the lifecycle of the app and get the android.app.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.
-
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
-
registerExtensions
static void )>registerExtensions(@NonNull() List<Class<out Extension>> extensions, @Nullable() AdobeCallback<?> 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.- Parameters:
event- the Event to be dispatched, used as a trigger.timeoutMS- the timeout specified in milliseconds.responseCallback- the callback whose call will be called when the response event is heard.
-
setSmallIconResourceID
static void setSmallIconResourceID(int resourceID)
Sets the resource Id for small icon.
- Parameters:
resourceID- the resource Id of the icon
-
setLargeIconResourceID
static void setLargeIconResourceID(int resourceID)
Sets the resource Id for small icon.
- Parameters:
resourceID- the resource Id of the icon
-
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 Launch.
-
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
-
getMessagingDelegate
@Nullable() static MessagingDelegate getMessagingDelegate()
Gets a previously set Message delegate.
-
setMessagingDelegate
static void setMessagingDelegate(@Nullable() MessagingDelegate messagingDelegate)
Sets a Message delegate used to listen for current message lifecycle events.
- Parameters:
messagingDelegate- MessagingDelegate to use for listening to current message lifecycle events
-
log
@Deprecated() static void log(@NonNull() LoggingMode mode, String tag, String message)
Sends a log message of the given
LoggingMode. If the specifiedmodeis more verbose than the current LoggingMode set from setLogLevel then the message is not printed.- Parameters:
mode- the LoggingMode used to print the message.tag- used to identify the source of the log messagemessage- the message to log
-
registerExtension
@Deprecated() static boolean )>registerExtension(@NonNull() Class<out Extension> extensionClass, @Nullable() ExtensionErrorCallback<ExtensionError> errorCallback)
Registers an extension class which has
Extensionas parent.In order to ensure that your extension receives all the internal events, this method needs to be called after setApplication is called, but before any other method in this class.
- Parameters:
extensionClass- a class whose parent is Extension.errorCallback- an optional ExtensionErrorCallback for the eventuality of an error, called when this method returns false
-
start
@Deprecated() static void )>start(@Nullable() AdobeCallback<?> completionCallback)
Start the Core processing. This should be called after the initial set of extensions have been registered.
This call will wait for any outstanding registrations to complete and then start event processing. You can use the callback to kickoff additional operations immediately after any operations kicked off during registration. You shouldn't call this method more than once in your app, if so, sdk will ignore it and print error log.
- Parameters:
completionCallback- an optional AdobeCallback invoked after registrations are completed
-
dispatchEventWithResponseCallback
@Deprecated() static void )>dispatchEventWithResponseCallback(@NonNull() Event event, @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 after API_TIMEOUT_MS milliseconds.- Parameters:
event- the Event to be dispatched, used as a trigger.responseCallback- the callback whose call will be called when the response event is heard.
-
dispatchEvent
@Deprecated() static boolean )>dispatchEvent(@NonNull() Event event, @Nullable() ExtensionErrorCallback<ExtensionError> errorCallback)
Called by the extension public API to dispatch an event for other extensions or the internal SDK to consume.
- Parameters:
event- the Event instance to be dispatched.errorCallback- optional ExtensionErrorCallback which will be called if an error occurred during dispatching
-
dispatchEventWithResponseCallback
@Deprecated() static boolean ,ExtensionErrorCallback
)>dispatchEventWithResponseCallback (@NonNull() Event event, @NonNull() AdobeCallback<Event> responseCallback, @Nullable() ExtensionErrorCallback<ExtensionError> errorCallback)This method will be used when the provided
Eventis used as a trigger and a response event is expected in return. The returned event needs to be sent using )>dispatchResponseEvent.Passes an ExtensionError to
errorCallbackifeventorresponseCallbackare null.- Parameters:
event- the Event instance to be dispatched, used as a trigger.responseCallback- the AdobeCallback to be called with the response event received.errorCallback- optional ExtensionErrorCallback which will be called if an error occurred during dispatching
-
dispatchResponseEvent
@Deprecated() static boolean )>dispatchResponseEvent(@NonNull() Event responseEvent, @NonNull() Event requestEvent, @Nullable() ExtensionErrorCallback<ExtensionError> errorCallback)
Dispatches a response event for a paired event that was sent to
dispatchEventWithResponseCallbackand received by an extension listenerhearmethod.Passes an ExtensionError to
errorCallbackifresponseEventorrequestEventare null.Note: The
responseEventwill not be sent to any listeners, it is sent only to the response callback registered using ,ExtensionErrorCallback)>dispatchEventWithResponseCallback .- Parameters:
responseEvent- the Event instance dispatched as response to request event.requestEvent- the Event instance which acts as a trigger for response event.errorCallback- optional ExtensionErrorCallback which will be called if an error occurred during dispatching
-
-
-
-