Screen State
Supported on Android & iOS.
This data source records the time that the device's display turns on/off and the time that the device gets locked/unlocked. For each change in either the display state (on/off) or the lock state (locked/unlocked), a new record is created containing the previous state of whichever changed.
The data source does not record the content of the screen or the reason for changes. It only captures the change and timing information.
Each screen state record includes the following:
Record Time: The time the previous state of the device had started.
Internally stored as record_time
.
End Time: The time the previous state of the device had ended. Internally
stored as end_time
.
State: Whether the display turned on or off. Internally stored as state
.
This is true
if the display was on and false
if the display was off. If the
display state hasn't changed, this will be null
.
Lock State: Whether the device was locked or unlocked. Internally stored as
lock_state
. This is locked
if the device was locked and unlocked
if the
device was unlocked. If the lock state hasn't changed, this will be null
.
Interpretation
A given record of this data source looks like the following:
{
"study_id": 1,
"user_id": 2,
"device_id": "2bae23410b7063ec",
"record_time": 1606939056984,
"end_time": 1606939060036,
"state": true,
"lock_state": null
}
This means user ID 2 on device ID 2bae23410b7063ec
, turned on the device
(state is true
) at 1606939056984 (2020-12-02 14:57:36.984-05:00
) and the
device was on until 1606939060036 (2020-12-02 14:57:40.036-05:00
). The
lock_state
is null
because this record represents a change in the display
state only and each record captures a change in either the display state or lock
state, but not both.
Consecutive Records with Duplicate State
When exporting Screen State data, you may see consecutive entries with the same
State
(e.g., two "False" values). This occurs due to app lifecycle events in
mobile operating systems.
Sometimes, the Avicenna app is terminated and restarted during data collection. Mobile operating systems may kill background apps to conserve resources, then restart them later. When Avicenna restarts, it records the current screen state again, which may match the previously recorded state.
For the purpose of data analysis, you can simply discard consecutive records with duplicate states and only use the first reported state.