-
public class AnalyticsClient
Analytics client can be used to publish analytics event to the list of registered analytics handlers. By default the analytics client will attempt to send the analytics event to the Brightcove analytics collector. This default behavior can be change add custom handlers.
-
-
Field Summary
Fields Modifier and Type Field Description public static long
DEFAULT_BACKLOG_LIMIT
public static int
DEFAULT_RETRY_LIMIT
public static int
DEFAULT_BATCH_SIZE
-
Method Summary
Modifier and Type Method Description static AnalyticsClient
getInstance(@NonNull() Context context)
Provides reference to the single instance of AnalyticsClient. static boolean
setNetworkEnabled(int type, boolean enabled)
Sets whether the specified network type is enabled for transmission of analytics events. static void
enableNetwork(int type)
Enables the specified network type for transmission of analytics events. static void
disableNetwork(int type)
Disables the specified network type for transmission of analytics events. static boolean
isNetworkEnabled(int type)
Checks if the specified network type is currently enabled for transmission of analytics events. static SparseArray<Boolean>
getNetworkEntitlements()
Gets the network entitlements for transmission of analytics events. static long
getBacklogLimit()
Gets the maximum size of the analytics events backlog, expressed as total number ofbytes. static void
setBacklogLimit(long backlogLimit)
Sets the maximum size of the analytics events backlog, expressed as total number ofbytes. static int
getRetryLimit()
Gets the maximum number of attempts that will be made to send NORMAL events. static void
setRetryLimit(int retryLimit)
Sets the maximum number of attempts that will be made to send NORMAL events. static int
getBatchSize()
Gets the maximum number of events that will be processed in a batch when transmitting backlog. static void
setBatchSize(int batchSize)
Sets the maximum number of events that will be processed in a batch when transmitting backlog. AnalyticsClient
addHandler(@NonNull() IAnalyticsHandler handler)
Adds the specified handler to the set of handlers that will be notified when an analyticsevent is received. AnalyticsClient
removeHandler(@NonNull() IAnalyticsHandler handler)
Removed the specified handler to the set of handlers that will be notified when an analyticsevent is received. AnalyticsClient
removeAllHandlers()
Removes all handlers that are currently registered with client. AnalyticsClient
publish(@NonNull() AnalyticsEvent event, @NonNull() IAnalyticsErrorListener errorHandler)
Publishes the specified event to the current set of registered analytics handlers. -
-
Method Detail
-
getInstance
static AnalyticsClient getInstance(@NonNull() Context context)
Provides reference to the single instance of AnalyticsClient.
- Parameters:
context
- context of the host activity or application.
-
setNetworkEnabled
static boolean setNetworkEnabled(int type, boolean enabled)
Sets whether the specified network type is enabled for transmission of analytics events.
- Parameters:
type
- the type of the network.enabled
- true, if the network should be enabled for analytics transmission, otherwise false.
-
enableNetwork
static void enableNetwork(int type)
Enables the specified network type for transmission of analytics events.
- Parameters:
type
- the type of the network.
-
disableNetwork
static void disableNetwork(int type)
Disables the specified network type for transmission of analytics events.
- Parameters:
type
- the type of the network.
-
isNetworkEnabled
static boolean isNetworkEnabled(int type)
Checks if the specified network type is currently enabled for transmission of analytics events.
- Parameters:
type
- the type of the network.
-
getNetworkEntitlements
static SparseArray<Boolean> getNetworkEntitlements()
Gets the network entitlements for transmission of analytics events.
-
getBacklogLimit
static long getBacklogLimit()
Gets the maximum size of the analytics events backlog, expressed as total number ofbytes.
-
setBacklogLimit
static void setBacklogLimit(long backlogLimit)
Sets the maximum size of the analytics events backlog, expressed as total number ofbytes.
- Parameters:
backlogLimit
- the maximum size of the analytics events backlog, expressed as totalnumber of bytes.
-
getRetryLimit
static int getRetryLimit()
Gets the maximum number of attempts that will be made to send NORMAL events.
-
setRetryLimit
static void setRetryLimit(int retryLimit)
Sets the maximum number of attempts that will be made to send NORMAL events.
- Parameters:
retryLimit
- the maximum number of attempts that will be made to send NORMAL events.
-
getBatchSize
static int getBatchSize()
Gets the maximum number of events that will be processed in a batch when transmitting backlog.
-
setBatchSize
static void setBatchSize(int batchSize)
Sets the maximum number of events that will be processed in a batch when transmitting backlog.
- Parameters:
batchSize
- the maximum number of events that will be processed in a batch when transmitting backlog.
-
addHandler
AnalyticsClient addHandler(@NonNull() IAnalyticsHandler handler)
Adds the specified handler to the set of handlers that will be notified when an analyticsevent is received.
- Parameters:
handler
- the handler to be added.
-
removeHandler
AnalyticsClient removeHandler(@NonNull() IAnalyticsHandler handler)
Removed the specified handler to the set of handlers that will be notified when an analyticsevent is received.
- Parameters:
handler
- the handler to be removed.
-
removeAllHandlers
AnalyticsClient removeAllHandlers()
Removes all handlers that are currently registered with client.
-
publish
AnalyticsClient publish(@NonNull() AnalyticsEvent event, @NonNull() IAnalyticsErrorListener errorHandler)
Publishes the specified event to the current set of registered analytics handlers.
- Parameters:
event
- the event to be published.errorHandler
- optional reference to an object that can handle errors in processingthe published analytics event.
-
-
-
-