AppTask
A task that the user does in the app, like filling in a survey.
When its trigger fires, an AppTaskExecutor wraps the task in a UserTask and puts it on the queue of the AppTaskController. The app shows the queue as a task list, and the user starts, completes, or cancels the task.
Key points:
- type says what kind of task it is, e.g. SURVEY_TYPE. Sampling packages provide subclasses, e.g.
RPAppTaskin carp_survey_package. - measures are collected in the background while the task is running.
- A
dk.cachet.carp.completedapptask.<type>measure is always added, so a CompletedAppTask is collected when the task is done. - expire removes the task from the queue; notification sends a notification via the NotificationManager.
protocol.addTaskControl(
RecurrentScheduledTrigger(type: RecurrentType.daily, time: TimeOfDay(hour: 8)),
AppTask(type: AppTask.SURVEY_TYPE, title: 'Daily survey', notification: true),
phone,
);
- Inheritance
-
- Object
- Serializable
- TaskConfiguration
- AppTask
- Annotations
-
- @JsonSerializable(includeIfNull: false, explicitToJson: true)
Constructors
AppTask.fromJson
AppTask
Creates an app task that notifies the app when it is triggered.
name is a unique name of the task. measures is the list of measures to be collected in the background when this app task is started. type provide a unique type for this kind of app task.
Constants
AUDIO_TYPE
An audio app task. Used in the carp_audio_package.
COGNITIVE_ASSESSMENT_TYPE
A cognitive assessment app task. Used in the carp_survey_package for RPAppTasks.
HEALTH_ASSESSMENT_TYPE
An app task collecting health data. Used in the carp_health_package.
IMAGE_TYPE
An image app task. Used in the carp_audio_package.
INFORMED_CONSENT_TYPE
An informed consent app task.
SENSING_TYPE
A background sensing user task which can be started and stopped by the user.
SURVEY_TYPE
A survey app task. Used in the carp_survey_package for RPAppTasks.
VIDEO_TYPE
A video app task. Used in the carp_audio_package.
Properties
backgroundTask
The list of background measures as a BackgroundTask.
description
A short description (one line) of this task. Can be used in the app.
expire
How long this task stays on the AppTaskController's queue before it expires and is removed. If null, the task never expires.
fromJsonFunction
The function which can convert a JSON string to an object of this type.
instructions
A longer instruction text explaining how a user should perform this task.
minutesToComplete
How many minutes will it take for the user to perform this task? Typically shown to the user before engaging into this task. If null the task has no completion time.
notification
Whether to send a notification to the user when the task is triggered. Default is false.
title
A title for this task. Can be used in the app.
type
The type of task, e.g. SURVEY_TYPE. Any string is allowed.
Methods
toJson
Return a JSON encoding of this object.