public class SessionClient extends Object
Modifier and Type | Class and Description |
---|---|
protected static class |
SessionClient.SessionState
Internal Representation of Application Session's state
|
Modifier and Type | Field and Description |
---|---|
protected static String |
NO_SESSION_ID
This is the identifier set when there is no current session
|
protected com.amazonaws.mobileconnectors.pinpoint.internal.core.PinpointContext |
pinpointContext
The context object wraps all the essential information from the app
that are required.
|
protected Session |
session
This session object tracks whether or not it has been paused by checking the
status of it's stop time.
|
static String |
SESSION_PAUSE_EVENT_TYPE
The eventType recorded for session pause events
|
static String |
SESSION_RESUME_EVENT_TYPE
The eventType recorded for session resume events
|
static String |
SESSION_START_EVENT_TYPE
The eventType recorded for session start events
|
static String |
SESSION_STOP_EVENT_TYPE
The eventType recorded for session stop events
|
protected static String |
SHARED_PREFS_SESSION_KEY
The key name used in Shared Preferences
|
Constructor and Description |
---|
SessionClient(com.amazonaws.mobileconnectors.pinpoint.internal.core.PinpointContext pinpointContext)
CONSTRUCTOR
|
Modifier and Type | Method and Description |
---|---|
protected void |
executePause()
Pause the current session object - Fire a Session Pause Event - Persist
Session to the file system.
|
protected void |
executeResume()
Re-Activate the session - Fire Session Resume Event/
Record an event of type
SESSION_RESUME_EVENT_TYPE |
protected void |
executeStart()
Start a new Session.
|
protected void |
executeStop()
Stop the current Session.
|
protected Session |
getSession()
Getters
|
protected SessionClient.SessionState |
getSessionState() |
void |
pauseSession()
Briefly pauses an application session.
|
void |
resumeSession()
Resumes an application session.
|
void |
startSession()
Start a session which records a
SESSION_START_EVENT_TYPE event and
saves that sessionId to the AnalyticsClient to be used for recording future
events. |
void |
stopSession()
Stops a session which records a
SESSION_STOP_EVENT_TYPE
event and flushes the events in localstorage for submission. |
String |
toString()
Overridden toString method for testing
|
public static final String SESSION_START_EVENT_TYPE
public static final String SESSION_STOP_EVENT_TYPE
public static final String SESSION_PAUSE_EVENT_TYPE
public static final String SESSION_RESUME_EVENT_TYPE
protected static final String NO_SESSION_ID
protected static final String SHARED_PREFS_SESSION_KEY
protected final com.amazonaws.mobileconnectors.pinpoint.internal.core.PinpointContext pinpointContext
protected Session session
public SessionClient(com.amazonaws.mobileconnectors.pinpoint.internal.core.PinpointContext pinpointContext)
pinpointContext
- The PinpointContext
public void startSession()
SESSION_START_EVENT_TYPE
event and
saves that sessionId to the AnalyticsClient to be used for recording future
events. This triggers an update of the endpointProfile. It is recommended to
start the session when the application comes to the foreground.public void stopSession()
SESSION_STOP_EVENT_TYPE
event and flushes the events in localstorage for submission.
It is recommended to stop the session when the application
goes to the background.public void pauseSession()
SESSION_PAUSE_EVENT_TYPE
event.
It is recommended to call in an activity's onPause() method.public void resumeSession()
SESSION_RESUME_EVENT_TYPE
event.
It is recommended to call in an activity's onResume() method.public String toString()
protected void executeStart()
SESSION_START_EVENT_TYPE
.protected void executeStop()
SESSION_STOP_EVENT_TYPE
. Additionally, stopping a session
clears the campaign attributes.protected void executePause()
SESSION_PAUSE_EVENT_TYPE
protected void executeResume()
SESSION_RESUME_EVENT_TYPE
protected Session getSession()
protected SessionClient.SessionState getSessionState()
Copyright © 2019. All rights reserved.