Package 

Class InMemoryDebugAnalyticsProvider

  • All Implemented Interfaces:
    com.shalan.analytics.core.AnalyticsProvider , com.shalan.analytics.core.DebugAnalyticsProvider

    
    public final class InMemoryDebugAnalyticsProvider
     implements DebugAnalyticsProvider
                        

    An in-memory implementation of DebugAnalyticsProvider for testing and debugging. It stores logged events in a list, allowing them to be retrieved and inspected. It also supports a mock mode, which can be used to simulate analytics behavior.

    • Constructor Detail

      • InMemoryDebugAnalyticsProvider

        InMemoryDebugAnalyticsProvider()
    • Method Detail

      • logEvent

         Unit logEvent(String eventName, Map<String, Object> parameters)

        Logs a generic event. If mock mode is enabled, it only logs to Logcat. Otherwise, it stores the event in memory and logs to Logcat.

        Parameters:
        eventName - The name of the event to log.
        parameters - A map of key-value pairs representing the event's properties.
      • setUserId

         Unit setUserId(String userId)

        Sets the user ID. Logs to Logcat.

        Parameters:
        userId - The unique identifier for the user.
      • setUserProperty

         Unit setUserProperty(String key, String value)

        Sets a user property. Logs to Logcat.

        Parameters:
        key - The name of the user property.
        value - The value of the user property.
      • setMockMode

         Unit setMockMode(Boolean enabled)

        Sets the mock mode for this provider.

        Parameters:
        enabled - true to enable mock mode, false to disable it.