Package com.mparticle
Class SdkListener
- java.lang.Object
-
- com.mparticle.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.
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static class
SdkListener.DatabaseTable
static class
SdkListener.Endpoint
-
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)
Callback forIdentityApi.aliasUsers(AliasRequest)
results.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.
-
-
-
Field Detail
-
ERROR_MESSAGE
public static final java.lang.String ERROR_MESSAGE
- See Also:
- Constant Field Values
-
-
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 methodobjects
- the arguments used in the invocationisExternal
- 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, seeSdkListener.DatabaseTable
primaryKey
- a unique identifier for the database rowmessage
- the database entry in JSON form
-
onNetworkRequestStarted
public void onNetworkRequestStarted(@NonNull SdkListener.Endpoint type, @NonNull java.lang.String url, @NonNull org.json.JSONObject body)
Indicates that a Network Request has been started. Network Requests for a givenSdkListener.Endpoint
are performed. synchronously, so the next invocation ofonNetworkRequestStarted(Endpoint, String, JSONObject)
of the sameSdkListener.Endpoint
, will refer to the same request- Parameters:
type
- the type of network request, seeSdkListener.Endpoint
url
- the URL of the requestbody
- the response body 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 givenSdkListener.Endpoint
are performed synchronously, so any invocation will refer to the same request as the most recent.onNetworkRequestStarted(Endpoint, String, JSONObject)
invocation of the sameSdkListener.Endpoint
- Parameters:
type
- the type of network request, seeSdkListener.Endpoint
url
- the URL of the requestresponse
- the response body in JSON formresponseCode
- 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 aMParticle.ServiceProviders
apiName
- the method name which was invokedinvokingMethodName
- the SDK Api call which triggered the invocation, if there was onekitManagerMethodName
- the KitManager call which serverd as the intermediate trigger of the invocation, if there was oneobjects
- the arguments passedused
- whether aReportingService.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 aMParticle.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 aMParticle.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 aMParticle.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 orConsentState
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 aMParticle.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 currentInternalSession
instance
-
onAliasRequestFinished
public void onAliasRequestFinished(AliasResponse aliasResponse)
Callback forIdentityApi.aliasUsers(AliasRequest)
results.- Parameters:
aliasResponse
-
-
-