Package com.mparticle

Class SdkListener


  • public class SdkListener
    extends java.lang.Object
    Note: This is an Experimental feature. Adding an instance of SdkListener will slow down the SDK and should be used only in development. SdkListener is a new feature which enables updates on and visibility into internal Events occuring inside the SDK.
    • Field Summary

      Fields 
      Modifier and Type Field Description
      static java.lang.String ERROR_MESSAGE  
    • Constructor Summary

      Constructors 
      Constructor Description
      SdkListener()  
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      void onAliasRequestFinished​(AliasResponse aliasResponse)
      void onApiCalled​(java.lang.String apiName, java.util.List<java.lang.Object> objects, boolean isExternal)
      Indicates that an API method was called.
      void onEntityStored​(SdkListener.DatabaseTable tableName, long primaryKey, org.json.JSONObject message)
      Indicates that a new Database entry has been created.
      void onKitApiCalled​(int kitId, java.lang.String apiName, java.lang.String invokingMethodName, java.lang.String kitManagerMethodName, java.util.List<java.lang.Object> objects, boolean used)
      Indicates that a Kit method was invoked.
      void onKitConfigReceived​(int kitId, org.json.JSONObject configuration)
      Indicates that a Configuration for a kit with kitId is being applied.
      void onKitDetected​(int kitId)
      Indicates that a Kit module, with kitId, is present in the classpath.
      void onKitExcluded​(int kitId, java.lang.String reason)
      Indicates that either an attempt to start a kit was unsuccessful, or a started kit was stopped.
      void onKitStarted​(int kitId)
      Indicates that a kit with kitId was successfully started.
      void onNetworkRequestFinished​(SdkListener.Endpoint type, java.lang.String url, org.json.JSONObject response, int responseCode)
      Indicates that a Network Request has completed.
      void onNetworkRequestStarted​(SdkListener.Endpoint type, java.lang.String url, org.json.JSONObject body)
      Indicates that a Network Request has been started.
      void onSessionUpdated​(com.mparticle.internal.InternalSession session)
      Indicates that state of a Session may have changed.
      • Methods inherited from class java.lang.Object

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

      • SdkListener

        public SdkListener()
    • Method Detail

      • onApiCalled

        public void onApiCalled​(@NonNull
                                java.lang.String apiName,
                                @NonNull
                                java.util.List<java.lang.Object> objects,
                                boolean isExternal)
        Indicates that an API method was called. This includes invocations both from external sources (your code) and those which originated from within the SDK.
        Parameters:
        apiName - the name of the Api method
        objects - the arguments used in the invocation
        isExternal - true, if the call originated from outside of the SDK
      • onEntityStored

        public void onEntityStored​(@NonNull
                                   SdkListener.DatabaseTable tableName,
                                   @NonNull
                                   long primaryKey,
                                   @NonNull
                                   org.json.JSONObject message)
        Indicates that a new Database entry has been created.
        Parameters:
        tableName - the name of the table, see SdkListener.DatabaseTable
        primaryKey - a unique identifier for the database row
        message - the database entry in JSON form
      • onNetworkRequestFinished

        public void onNetworkRequestFinished​(@NonNull
                                             SdkListener.Endpoint type,
                                             @NonNull
                                             java.lang.String url,
                                             @Nullable
                                             org.json.JSONObject response,
                                             int responseCode)
        Indicates that a Network Request has completed. Network Requests for a given SdkListener.Endpoint are performed synchronously, so any invocation will refer to the same request as the most recent. onNetworkRequestStarted(Endpoint, String, JSONObject) invocation of the same SdkListener.Endpoint
        Parameters:
        type - the type of network request, see SdkListener.Endpoint
        url - the URL of the request
        response - the response body in JSON form
        responseCode - the HTTP response code
      • onKitApiCalled

        public void onKitApiCalled​(int kitId,
                                   @NonNull
                                   java.lang.String apiName,
                                   @Nullable
                                   java.lang.String invokingMethodName,
                                   @Nullable
                                   java.lang.String kitManagerMethodName,
                                   @NonNull
                                   java.util.List<java.lang.Object> objects,
                                   boolean used)
        Indicates that a Kit method was invoked.
        Parameters:
        kitId - the id of the kit, corresponds with a MParticle.ServiceProviders
        apiName - the method name which was invoked
        invokingMethodName - the SDK Api call which triggered the invocation, if there was one
        kitManagerMethodName - the KitManager call which serverd as the intermediate trigger of the invocation, if there was one
        objects - the arguments passed
        used - whether a ReportingService.ReportingMessage was generated as a result of the invocation. ReportingService.ReportingMessage indicate that an argument was consumed by the Kit
      • onKitDetected

        public void onKitDetected​(int kitId)
        Indicates that a Kit module, with kitId, is present in the classpath.
        Parameters:
        kitId - the id of the kit, corresponse with a MParticle.ServiceProviders
      • onKitConfigReceived

        public void onKitConfigReceived​(int kitId,
                                        @NonNull
                                        org.json.JSONObject configuration)
        Indicates that a Configuration for a kit with kitId is being applied.
        Parameters:
        kitId - the id of the kit, corresponse with a MParticle.ServiceProviders
        configuration - the configuration in JSON form
      • onKitStarted

        public void onKitStarted​(int kitId)
        Indicates that a kit with kitId was successfully started.
        Parameters:
        kitId - the id of the kit, corresponse with a MParticle.ServiceProviders
      • onKitExcluded

        public void onKitExcluded​(int kitId,
                                  @NonNull
                                  java.lang.String reason)
        Indicates that either an attempt to start a kit was unsuccessful, or a started kit was stopped. Possibilities for why this may happen include: MParticleUser's loggedIn status or ConsentState required it to be stopped, the Kit crashed, or a configuration was received with excluded the kit.
        Parameters:
        kitId - the id of the kit, corresponse with a MParticle.ServiceProviders
        reason - a message containing the reason a kit was stopped
      • onSessionUpdated

        public void onSessionUpdated​(@Nullable
                                     com.mparticle.internal.InternalSession session)
        Indicates that state of a Session may have changed.
        Parameters:
        session - the current InternalSession instance