Class SessionTracker

  • All Implemented Interfaces:
    com.microsoft.appcenter.channel.Channel.Listener

    public class SessionTracker
    extends com.microsoft.appcenter.channel.AbstractChannelListener
    Decorator for channel, adding session semantic to logs.
    • Constructor Summary

      Constructors 
      Constructor Description
      SessionTracker​(com.microsoft.appcenter.channel.Channel channel, java.lang.String groupName)
      Init.
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      void clearSessions()
      Clear storage from saved session state.
      void enableManualSessionTracker()
      Enable manual session tracker.
      void onActivityPaused()
      Call this whenever an activity is paused to update session tracker state.
      void onActivityResumed()
      Call this whenever an activity is resumed to update session tracker state.
      void onPreparingLog​(com.microsoft.appcenter.ingestion.models.Log log, java.lang.String groupName)  
      void startSession()
      Start a new session if manual session tracker is enabled, otherwise do nothing.
      • Methods inherited from class com.microsoft.appcenter.channel.AbstractChannelListener

        onClear, onGloballyEnabled, onGroupAdded, onGroupRemoved, onPaused, onPreparedLog, onResumed, shouldFilter
      • Methods inherited from class java.lang.Object

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

      • SessionTracker

        public SessionTracker​(com.microsoft.appcenter.channel.Channel channel,
                              java.lang.String groupName)
        Init.
        Parameters:
        channel - channel to decorate.
        groupName - group name used to send generated logs.
    • Method Detail

      • onPreparingLog

        public void onPreparingLog​(@NonNull
                                   com.microsoft.appcenter.ingestion.models.Log log,
                                   @NonNull
                                   java.lang.String groupName)
        Specified by:
        onPreparingLog in interface com.microsoft.appcenter.channel.Channel.Listener
        Overrides:
        onPreparingLog in class com.microsoft.appcenter.channel.AbstractChannelListener
      • onActivityResumed

        @WorkerThread
        public void onActivityResumed()
        Call this whenever an activity is resumed to update session tracker state.
      • onActivityPaused

        @WorkerThread
        public void onActivityPaused()
        Call this whenever an activity is paused to update session tracker state.
      • clearSessions

        public void clearSessions()
        Clear storage from saved session state.
      • enableManualSessionTracker

        public void enableManualSessionTracker()
        Enable manual session tracker.
      • startSession

        public void startSession()
        Start a new session if manual session tracker is enabled, otherwise do nothing.