Search in sources :

Example 1 with Session

use of com.amazonaws.services.pinpoint.model.Session in project aws-sdk-android by aws-amplify.

the class EventRecorder method buildEventPayload.

void buildEventPayload(AnalyticsEvent internalEvent, Event event) {
    final Session session = new Session();
    session.withId(internalEvent.getSession().getSessionId());
    session.withStartTimestamp(DateUtils.formatISO8601Date(new Date(internalEvent.getSession().getSessionStart())));
    if (internalEvent.getSession().getSessionStop() != null && internalEvent.getSession().getSessionStop() != 0L) {
        session.withStopTimestamp(DateUtils.formatISO8601Date(new Date(internalEvent.getSession().getSessionStop())));
    }
    if (internalEvent.getSession().getSessionDuration() != null && internalEvent.getSession().getSessionDuration() != 0L) {
        session.withDuration(internalEvent.getSession().getSessionDuration().intValue());
    }
    final AndroidAppDetails appDetails = internalEvent.getAppDetails();
    event.withAppPackageName(appDetails.packageName()).withAppTitle(appDetails.getAppTitle()).withAppVersionCode(appDetails.versionCode()).withAttributes(internalEvent.getAllAttributes()).withClientSdkVersion(internalEvent.getSdkVersion()).withEventType(internalEvent.getEventType()).withMetrics(internalEvent.getAllMetrics()).withSdkName(internalEvent.getSdkName()).withSession(session).withTimestamp(DateUtils.formatISO8601Date(new Date(internalEvent.getEventTimestamp())));
}
Also used : AndroidAppDetails(com.amazonaws.mobileconnectors.pinpoint.internal.core.system.AndroidAppDetails) Date(java.util.Date) Session(com.amazonaws.services.pinpoint.model.Session)

Aggregations

AndroidAppDetails (com.amazonaws.mobileconnectors.pinpoint.internal.core.system.AndroidAppDetails)1 Session (com.amazonaws.services.pinpoint.model.Session)1 Date (java.util.Date)1