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())));
}
Aggregations