io.replay.framework
Class ReplayIO

java.lang.Object
  extended by io.replay.framework.ReplayIO

public final class ReplayIO
extends java.lang.Object


Constructor Summary
ReplayIO()
           
 
Method Summary
static int count()
           
static void disable()
          Disable ReplayIO.
static void dispatch()
          Dispatch immediately.
static void enable()
          Enable ReplayIO.
static Config getConfig()
           
static java.lang.String getOrGenerateClientUUID()
          Get or generate a UUID as the client UUID.
static void identify()
          Clear the saved distinct ID.
static void identify(java.lang.String distinctId)
          Set the distinct ID to the value passed in.
static void init(android.content.Context context)
          Initializes the ReplayIO client.
static void init(android.content.Context context, Config options)
          Initializes the ReplayIO client.
static void init(android.content.Context context, java.lang.String apiKey)
          Initializes the ReplayIO client.
static boolean isDebugMode()
          Tell if debug mode is enabled.
static boolean isEnabled()
          Tell if ReplayIO is enabled.
static void onActivityCreate(android.content.Context context)
          Initializes the Replay.io client, kicks off all worker threads, and notifies the client that this activity has been created.
static void onActivityCreate(android.content.Context context, Config options)
          Initializes the Replay.io client, kicks off all worker threads, and notifies the client that this activity has been created.
static void onActivityCreate(android.content.Context context, java.lang.String apiKey)
          Initializes the Replay.io client, kicks off all worker threads, and notifies the client that this activity has been created.
static void onActivityPause(android.content.Context context)
          Called when the activity is paused.
static void onActivityResume(android.content.Context context)
          Called when the activity has been resumed.
static void onActivityStart(android.content.Context context)
          Initializes the Replay.io client, kicks off all worker threads, and notifies the client that this activity has been created.
static void onActivityStart(android.content.Context context, Config options)
          Initializes the Replay.io client, kicks off all worker threads, and notifies the client that this activity has been created.
static void onActivityStart(android.content.Context context, java.lang.String apiKey)
          Initializes the Replay.io client, kicks off all worker threads, and notifies the client that this activity has been created.
static void onActivityStop(android.content.Context context)
          Called when the activity has been stopped.
static void setDebugMode(boolean debug)
          Set debug mode.
static void start()
          Called when the app entered foreground.
static void stop()
          Called when the app entered background.
static void track(java.lang.String eventName)
          Send event to the server.
static void track(java.lang.String eventName, java.util.Map<java.lang.String,?> data)
          Send event with data to server.
static void track(java.lang.String eventName, java.lang.Object... data)
          Send event with data to server.
static void updateTraits(java.util.Map<java.lang.String,?> data)
          Update traits.
static void updateTraits(java.lang.Object... data)
          Update traits.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

ReplayIO

public ReplayIO()
Method Detail

init

public static void init(android.content.Context context)
Initializes the ReplayIO client. Loads the configuration parameters /res/values/replay_io.xml, including the Replay API key, which is required to be present in order to communicate with the server. It is acceptable to call this class from the main UI thread.

Parameters:
context - The application context. Use application context instead of activity context to avoid the risk of memory leak.

init

public static void init(android.content.Context context,
                        java.lang.String apiKey)
Initializes the ReplayIO client. Loads the configuration parameters /res/values/replay_io.xml, including the Replay API key, which is required to be present in order to communicate with the server. It is acceptable to call this class from the main UI thread.

Parameters:
context - The application context. We use application context instead of activity context to avoid the risk of memory leak.
apiKey - the Replay API key

init

public static void init(android.content.Context context,
                        Config options)
                 throws ReplayIONoKeyException
Initializes the ReplayIO client. Loads the configuration parameters from the provided options object, including the Replay API key, which is required to be present in order to communicate with the server. It is acceptable to call this class from the main UI thread.

Parameters:
context - The application context. We use application context instead of activity context to avoid the risk of memory leak.
options - a full Config object that contains initialization parameters.
Throws:
ReplayIONoKeyException

track

public static void track(java.lang.String eventName)
Send event to the server.

Parameters:
eventName - Name of the event

track

public static void track(java.lang.String eventName,
                         java.lang.Object... data)
Send event with data to server.

Parameters:
eventName - Name of the event.
data - Extra information to be tracked in the main JSON object.

track

public static void track(java.lang.String eventName,
                         java.util.Map<java.lang.String,?> data)
Send event with data to server.

Parameters:
eventName - Name of the event.
data - Extra information to be tracked in the main JSON object.

updateTraits

public static void updateTraits(java.lang.Object... data)
Update traits. Send a traits request to server side.

Parameters:
data - Extra information to be tracked in the main JSON object.

updateTraits

public static void updateTraits(java.util.Map<java.lang.String,?> data)
Update traits. Send a traits request to server side.

Parameters:
data - Extra information to be tracked in the main JSON object.

dispatch

public static void dispatch()
Dispatch immediately. When triggered, all requests in queue will be sent.


enable

public static void enable()
Enable ReplayIO. Allow sending requests.


disable

public static void disable()
Disable ReplayIO. Disallow sending requests.


isEnabled

public static boolean isEnabled()
Tell if ReplayIO is enabled.

Returns:
True if is enabled, false otherwise.

isDebugMode

public static boolean isDebugMode()
Tell if debug mode is enabled.

Returns:
True if enabled, false otherwise.

setDebugMode

public static void setDebugMode(boolean debug)
Set debug mode. When debug mode is on, logs will be printed.

Parameters:
debug - Boolean value to set to.

stop

public static void stop()
Called when the app entered background. ReplayQueue will stop running, , and the Session will be ended, too. .


start

public static void start()
Called when the app entered foreground. ReplayQueue will be restarted. A new session is started. If there are persisted requests, load them into queue.


getOrGenerateClientUUID

public static java.lang.String getOrGenerateClientUUID()
Get or generate a UUID as the client UUID. Generated client UUID will be saved.

Returns:
Client UUID.

onActivityCreate

public static void onActivityCreate(android.content.Context context)
Initializes the Replay.io client, kicks off all worker threads, and notifies the client that this activity has been created.

Parameters:
context - an instance of the Activity

onActivityCreate

public static void onActivityCreate(android.content.Context context,
                                    java.lang.String apiKey)
Initializes the Replay.io client, kicks off all worker threads, and notifies the client that this activity has been created.

Parameters:
context - an instance of the Activity
apiKey - the Replay API key

onActivityCreate

public static void onActivityCreate(android.content.Context context,
                                    Config options)
Initializes the Replay.io client, kicks off all worker threads, and notifies the client that this activity has been created.

Parameters:
context - an instance of the Activity
options - a full Config object that contains initialization parameters.

onActivityStart

public static void onActivityStart(android.content.Context context)
Initializes the Replay.io client, kicks off all worker threads, and notifies the client that this activity has been created.

Parameters:
context - an instance of the Activity

onActivityStart

public static void onActivityStart(android.content.Context context,
                                   java.lang.String apiKey)
Initializes the Replay.io client, kicks off all worker threads, and notifies the client that this activity has been created.

Parameters:
context - an instance of the Activity
apiKey - the Replay API key

onActivityStart

public static void onActivityStart(android.content.Context context,
                                   Config options)
Initializes the Replay.io client, kicks off all worker threads, and notifies the client that this activity has been created.

Parameters:
context - an instance of the Activity
options - a full Config object that contains initialization parameters.

onActivityResume

public static void onActivityResume(android.content.Context context)
Called when the activity has been resumed.

Parameters:
context - the activity

onActivityPause

public static void onActivityPause(android.content.Context context)
Called when the activity is paused.

Parameters:
context - the activity

onActivityStop

public static void onActivityStop(android.content.Context context)
Called when the activity has been stopped.

Parameters:
context -

identify

public static void identify(java.lang.String distinctId)
Set the distinct ID to the value passed in.

Parameters:
distinctId - New ID.

identify

public static void identify()
Clear the saved distinct ID. Convenience method for calling ReplayIO.identify("");.


count

public static int count()

getConfig

public static Config getConfig()