Class MobileCore

  • All Implemented Interfaces:

    
    public final class MobileCore
    
                        
    • Constructor Detail

    • Method Detail

      • 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.
      • 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 no Application was set or the Application process was destroyed.

      • 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 Event to dispatch an event for other extensions or the internal SDK to consume.

        Parameters:
        event - the Event to be dispatched.
      • 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 - String representing 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 - String representing 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 messageInfo Map. 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 filepath is 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 filepath is 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 null values is allowed and effectively removes the configuration parameter from the current configuration.

        Parameters:
        configMap - configuration key/value pairs to be updated or added.
      • 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.sessionTimeout configuration 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 action event

        Actions 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 - String containing the name of the action to track
        contextData - 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 state event

        States 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 - String containing the name of the state to track.
        contextData - optional contextData Map<String, String> containing context data to attach on this hit