Class RunLearningUnitResult
Depending on how the run ended, this class can be instantiated with one of the methods ofSuccess(java.lang.Float, long, java.lang.String, java.util.List<com.eidu.integration.ResultItem>), ofAbort(java.lang.Float, long, java.lang.String, java.util.List<com.eidu.integration.ResultItem>), ofTimeoutInactivity(java.lang.Float, long, java.lang.String, java.util.List<com.eidu.integration.ResultItem>), ofTimeUp(java.lang.Float, long, java.lang.String, java.util.List<com.eidu.integration.ResultItem>), ofError(java.lang.Float, long, java.lang.String, java.lang.String, java.util.List<com.eidu.integration.ResultItem>).
Then, toIntent() should be used to instantiate an Intent to be passed to
Activity.setResult(int, Intent) before finishing the activity.
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic enumAn enum describing the reason why a learning unit run has ended. -
Field Summary
FieldsModifier and TypeFieldDescriptionfinal StringOptional. An arbitrary string that the learning app would like to associate with the usage data that the EIDU app reports.final StringOptional. IfresultTypeisRunLearningUnitResult.ResultType.Error, this should contain any available diagnostic information, e.g.final longThe amount of time that the user spent with the learning unit at the end of the run.final List<ResultItem> Optional. A list of items describing the user interactions during a learning unit run in detail.The reason why this run ended.final FloatOptional. A score between 0.0f and 1.0f that describes how the learner did up to the point in time when the unit ended.final int -
Method Summary
Modifier and TypeMethodDescriptionbooleanstatic RunLearningUnitResultfromIntent(Intent intent) Parses anIntentinto a new RunLearningUnitResult instance.inthashCode()static RunLearningUnitResultofAbort(Float score, long foregroundDurationInMs, String additionalData, List<ResultItem> items) Creates an instance withRunLearningUnitResult.ResultType.Abort.static RunLearningUnitResultofError(Float score, long foregroundDurationInMs, String errorDetails, String additionalData, List<ResultItem> items) Creates an instance withRunLearningUnitResult.ResultType.Error.static RunLearningUnitResultofSuccess(Float score, long foregroundDurationInMs, String additionalData, List<ResultItem> items) Creates an instance withRunLearningUnitResult.ResultType.Success.static RunLearningUnitResultofTimeoutInactivity(Float score, long foregroundDurationInMs, String additionalData, List<ResultItem> items) Creates an instance withRunLearningUnitResult.ResultType.TimeoutInactivity.static RunLearningUnitResultofTimeUp(Float score, long foregroundDurationInMs, String additionalData, List<ResultItem> items) Creates an instance withRunLearningUnitResult.ResultType.TimeUp.toIntent()Converts this instance of RunLearningUnitResult to anIntentwhich may then be passed toActivity.setResult(int, Intent)in order to inform the EIDU app of the result of a learning unit run.
-
Field Details
-
version
public final int version -
resultType
The reason why this run ended. -
score
Optional. A score between 0.0f and 1.0f that describes how the learner did up to the point in time when the unit ended. value of 0.0f should indicate that the learner gave only incorrect answers, whereas a value of 1.0f should indicate the the learner gave only correct answers.In case the nature of the learning unit was such that there was no possibility to give an incorrect answer, the score must be 1.0f.
Only in case it's impossible to compute a meaningful score may this value be null. Learning app developers are strongly encouraged to try hard to compute meaningful scores in as many cases as possible, in order to provide the maximum amount of information for personalisation and analytics.
-
foregroundDurationInMs
public final long foregroundDurationInMsThe amount of time that the user spent with the learning unit at the end of the run. This must exclude any amount of time that the learning app was in the background (because the user navigated away from it, for example using the Android home button or because a different app forced itself into the foreground), and it should exclude time spent for loading and any transition animations. -
additionalData
Optional. An arbitrary string that the learning app would like to associate with the usage data that the EIDU app reports. It will be made available to the learning app manufacturer for data analysis purposes. It must not contain any sensitive data (e.g. device identifiers).This is useful because learning apps should not rely on (and should not attempt to take advantage of) Internet connectivity.
-
errorDetails
Optional. IfresultTypeisRunLearningUnitResult.ResultType.Error, this should contain any available diagnostic information, e.g. an exception with a stack trace.This information will be reported to EIDU for diagnostic purposes. It must not contain any sensitive data (e.g. device identifiers).
-
items
Optional. A list of items describing the user interactions during a learning unit run in detail. See the documentation ofResultItemfor details.Note that a
nullvalue signifies that no sensible representation of interactions is available, whereas an empty list signifies that no interactions occurred.
-
-
Method Details
-
ofSuccess
@NonNull public static RunLearningUnitResult ofSuccess(@Nullable Float score, long foregroundDurationInMs, @Nullable String additionalData, @Nullable List<ResultItem> items) Creates an instance withRunLearningUnitResult.ResultType.Success. This should be used when the learner completes the learning unit, independently of their performance.- Parameters:
score- Strongly encouraged, seescore.foregroundDurationInMs- Required, seeforegroundDurationInMs.additionalData- Optional, seeadditionalData.items- Optional, seeitems.- Returns:
- The new instance.
-
ofAbort
@NonNull public static RunLearningUnitResult ofAbort(@Nullable Float score, long foregroundDurationInMs, @Nullable String additionalData, @Nullable List<ResultItem> items) Creates an instance withRunLearningUnitResult.ResultType.Abort. This should be used when the learner took an action meant to abort the run, e.g. tapping an abort button.- Parameters:
score- Strongly encouraged, seescore.foregroundDurationInMs- Required, seeforegroundDurationInMs.additionalData- Optional, seeadditionalData.items- Optional, seeitems.- Returns:
- The new instance.
-
ofTimeoutInactivity
@NonNull public static RunLearningUnitResult ofTimeoutInactivity(@Nullable Float score, long foregroundDurationInMs, @Nullable String additionalData, @Nullable List<ResultItem> items) Creates an instance withRunLearningUnitResult.ResultType.TimeoutInactivity. This should be used after the learner hasn't interacted with the app forRunLearningUnitRequest.inactivityTimeoutInMsmilliseconds of foreground time.- Parameters:
score- Strongly encouraged, seescore.foregroundDurationInMs- Required, seeforegroundDurationInMs.additionalData- Optional, seeadditionalData.items- Optional, seeitems.- Returns:
- The new instance.
-
ofTimeUp
@NonNull public static RunLearningUnitResult ofTimeUp(@Nullable Float score, long foregroundDurationInMs, @Nullable String additionalData, @Nullable List<ResultItem> items) Creates an instance withRunLearningUnitResult.ResultType.TimeUp. This should be used afterRunLearningUnitRequest.remainingForegroundTimeInMsmilliseconds of foreground time passed since the start of the run.- Parameters:
score- Strongly encouraged, seescore.foregroundDurationInMs- Required, seeforegroundDurationInMs.additionalData- Optional, seeadditionalData.items- Optional, seeitems.- Returns:
- The new instance.
-
ofError
@NonNull public static RunLearningUnitResult ofError(@Nullable Float score, long foregroundDurationInMs, @NonNull String errorDetails, @Nullable String additionalData, @Nullable List<ResultItem> items) Creates an instance withRunLearningUnitResult.ResultType.Error. This should be used to indicate that a technical error occurred that prevented the learner from beginning or from completing the run.- Parameters:
score- Strongly encouraged, seescore.foregroundDurationInMs- Required, seeforegroundDurationInMs.errorDetails- Required, seeerrorDetails.additionalData- Optional, seeadditionalData.items- Optional, seeitems.- Returns:
- The new instance.
-
fromIntent
Parses anIntentinto a new RunLearningUnitResult instance.- Parameters:
intent- The intent to parse.- Returns:
- The new instance.
- Throws:
IllegalArgumentException- If the intent contains incomplete or invalid data.
-
toIntent
Converts this instance of RunLearningUnitResult to anIntentwhich may then be passed toActivity.setResult(int, Intent)in order to inform the EIDU app of the result of a learning unit run.- Returns:
- An intent that contains all information of this instance of RunLearningUnitResult.
-
equals
-
hashCode
public int hashCode()
-