Class AnalyticsTransmissionTarget


  • public class AnalyticsTransmissionTarget
    extends java.lang.Object
    Target for advanced transmission target usage.
    • Method Summary

      All Methods Static Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      static void addAuthenticationProvider​(AuthenticationProvider authenticationProvider)
      Add an authentication provider to associate logs with user identifiers.
      PropertyConfigurator getPropertyConfigurator()
      Getter for property configurator to override Common Schema Part A properties.
      AnalyticsTransmissionTarget getTransmissionTarget​(java.lang.String transmissionTargetToken)
      Create a new transmission target based on the properties of the current target.
      com.microsoft.appcenter.utils.async.AppCenterFuture<java.lang.Boolean> isEnabledAsync()
      Check whether this target is enabled or not.
      void pause()
      Pauses log transmission for this target.
      void resume()
      Resumes log transmission for this target.
      com.microsoft.appcenter.utils.async.AppCenterFuture<java.lang.Void> setEnabledAsync​(boolean enabled)
      Enable or disable this target.
      void trackEvent​(java.lang.String name)
      Track a custom event with name.
      void trackEvent​(java.lang.String name, EventProperties properties)
      Track a custom event with name and optional string properties.
      void trackEvent​(java.lang.String name, EventProperties properties, int flags)
      Track a custom event with name and optional string properties.
      void trackEvent​(java.lang.String name, java.util.Map<java.lang.String,​java.lang.String> properties)
      Track a custom event with name and optional string properties.
      void trackEvent​(java.lang.String name, java.util.Map<java.lang.String,​java.lang.String> properties, int flags)
      Track a custom event with name and optional string properties.
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Method Detail

      • addAuthenticationProvider

        public static void addAuthenticationProvider​(AuthenticationProvider authenticationProvider)
        Add an authentication provider to associate logs with user identifiers. Events tracked previous to calling this method are not impacted by this call. If the callback from the authentication provider takes a long time to process, events might be tracked anonymously.

        If you want to wait for authentication callback to complete before processing logs, you can pause and resume Analytics or a specific transmission target.

        Parameters:
        authenticationProvider - The authentication provider.
      • trackEvent

        public void trackEvent​(java.lang.String name)
        Track a custom event with name.

        The name cannot be null and needs to match the [a-zA-Z0-9]((\.(?!(\.|$)))|[_a-zA-Z0-9]){3,99} regular expression.

        Parameters:
        name - An event name.
      • trackEvent

        public void trackEvent​(java.lang.String name,
                               java.util.Map<java.lang.String,​java.lang.String> properties)
        Track a custom event with name and optional string properties.

        The following rules apply:

        • The event name needs to match the [a-zA-Z0-9]((\.(?!(\.|$)))|[_a-zA-Z0-9]){3,99} regular expression.
        • The property names or values cannot be null.
        • The baseData and baseDataType properties are reserved and thus discarded.
        • The full event size when encoded as a JSON string cannot be larger than 1.9MB.
        Parameters:
        name - An event name.
        properties - Optional properties.
      • trackEvent

        public void trackEvent​(java.lang.String name,
                               java.util.Map<java.lang.String,​java.lang.String> properties,
                               int flags)
        Track a custom event with name and optional string properties.

        The following rules apply:

        • The event name needs to match the [a-zA-Z0-9]((\.(?!(\.|$)))|[_a-zA-Z0-9]){3,99} regular expression.
        • The property names or values cannot be null.
        • The baseData and baseDataType properties are reserved and thus discarded.
        • The full event size when encoded as a JSON string cannot be larger than 1.9MB.
        Parameters:
        name - An event name.
        properties - Optional properties.
        flags - Optional flags. Events tracked with the Flags.CRITICAL flag will take precedence over all other events in storage. An event tracked with this option will only be dropped if storage must make room for a newer event that is also marked with the Flags.CRITICAL flag.
      • trackEvent

        public void trackEvent​(java.lang.String name,
                               EventProperties properties)
        Track a custom event with name and optional string properties.

        The following rules apply:

        • The event name needs to match the [a-zA-Z0-9]((\.(?!(\.|$)))|[_a-zA-Z0-9]){3,99} regular expression.
        • The property names or values cannot be null.
        • Double values must be finite (NaN or Infinite values are discarded).
        • The baseData and baseDataType properties are reserved and thus discarded.
        • The full event size when encoded as a JSON string cannot be larger than 1.9MB.
        Parameters:
        name - An event name.
        properties - Optional properties.
      • trackEvent

        public void trackEvent​(java.lang.String name,
                               EventProperties properties,
                               int flags)
        Track a custom event with name and optional string properties.

        The following rules apply:

        • The event name needs to match the [a-zA-Z0-9]((\.(?!(\.|$)))|[_a-zA-Z0-9]){3,99} regular expression.
        • The property names or values cannot be null.
        • Double values must be finite (NaN or Infinite values are discarded).
        • The baseData and baseDataType properties are reserved and thus discarded.
        • The full event size when encoded as a JSON string cannot be larger than 1.9MB.
        Parameters:
        name - An event name.
        properties - Optional properties.
        flags - Optional flags. Events tracked with the Flags.CRITICAL flag will take precedence over all other events in storage. An event tracked with this option will only be dropped if storage must make room for a newer event that is also marked with the Flags.CRITICAL flag.
      • getTransmissionTarget

        public AnalyticsTransmissionTarget getTransmissionTarget​(java.lang.String transmissionTargetToken)
        Create a new transmission target based on the properties of the current target.
        Parameters:
        transmissionTargetToken - The transmission target token of the new transmission target.
        Returns:
        The new transmission target.
      • isEnabledAsync

        public com.microsoft.appcenter.utils.async.AppCenterFuture<java.lang.Boolean> isEnabledAsync()
        Check whether this target is enabled or not.
        Returns:
        future with result being true if enabled, false otherwise.
        See Also:
        AppCenterFuture
      • setEnabledAsync

        public com.microsoft.appcenter.utils.async.AppCenterFuture<java.lang.Void> setEnabledAsync​(boolean enabled)
        Enable or disable this target. The state is applied on all descendant targets. The state is not changed if one ancestor target or Analytics module or AppCenter is disabled.
        Parameters:
        enabled - true to enable, false to disable.
        Returns:
        future with null result to monitor when the operation completes.
      • pause

        public void pause()
        Pauses log transmission for this target. This does not pause child targets.
      • resume

        public void resume()
        Resumes log transmission for this target. This does not resume child targets.
      • getPropertyConfigurator

        public PropertyConfigurator getPropertyConfigurator()
        Getter for property configurator to override Common Schema Part A properties.
        Returns:
        the Property Configurator