# Class LegacyAnalyticsProviderAdapter

java.lang.Object
com.codename1.analytics.AbstractAnalyticsProvider
com.codename1.analytics.LegacyAnalyticsProviderAdapter

All Implemented Interfaces:
  `AnalyticsProvider`

public class LegacyAnalyticsProviderAdapter extends AbstractAnalyticsProvider
Bridges a legacy `AnalyticsService` subclass into the new `AnalyticsProvider` SPI so that custom analytics implementations written against the deprecated API can participate in the `Analytics` facade alongside modern providers. Screen views are routed to the subclass's `visitPage` hook.

- ## Constructor Summary

  Constructors
  Constructor
  Description
  `LegacyAnalyticsProviderAdapter(AnalyticsService delegate)`
  Wraps a legacy analytics service.

- ## Method Summary

  Modifier and Type
  Method
  Description
  `String`
  `getName()`
  A short, stable, human readable name for this provider (used in logs and diagnostics).
  `boolean`
  `supports(AnalyticsCapability capability)`
  Indicates whether the provider supports a given capability.
  `void`
  `trackScreen(String name, String referrer)`
  Records a screen / page view.

  ### Methods inherited from class AbstractAnalyticsProvider

  `flush, getContext, init, onConsentChanged, reportCrash, setUserId, setUserProperty, trackEvent`

  ### Methods inherited from class Object

  `clone, equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

- ## Constructor Details

  - ### LegacyAnalyticsProviderAdapter

    public LegacyAnalyticsProviderAdapter(AnalyticsService delegate)

    Wraps a legacy analytics service.

    ###### Parameters

    - `delegate`: the legacy analytics service implementation

- ## Method Details

  - ### getName

    public String getName()
    Description copied from interface: `AnalyticsProvider`

    A short, stable, human readable name for this provider (used in logs and diagnostics).

    ###### Returns

    the provider name

    Specified by:
      `getName` in interface `AnalyticsProvider`
    Specified by:
      `getName` in class `AbstractAnalyticsProvider`

  - ### trackScreen

    public void trackScreen(String name, String referrer)
    Description copied from interface: `AnalyticsProvider`

    Records a screen / page view.

    ###### Parameters

    - `name`: the screen name

    - `referrer`: the previous screen name, may be null

    Specified by:
      `trackScreen` in interface `AnalyticsProvider`
    Overrides:
      `trackScreen` in class `AbstractAnalyticsProvider`

  - ### supports

    public boolean supports(AnalyticsCapability capability)
    Description copied from interface: `AnalyticsProvider`

    Indicates whether the provider supports a given capability.

    ###### Parameters

    - `capability`: the capability to query

    ###### Returns

    true if supported

    Specified by:
      `supports` in interface `AnalyticsProvider`
    Overrides:
      `supports` in class `AbstractAnalyticsProvider`