Keep data on the phone
This is the simplest option: no server, no accounts, no internet. Measurements are saved in the app’s private storage on the phone.
It’s one setting: the data endpoint
Section titled “It’s one setting: the data endpoint”Where data goes is decided by a single setting in the study protocol, the data endpoint. Local storage, CAWS and your own server differ only in this setting. The rest of the protocol (what to collect, and when) stays the same.
For local storage, pick one of two endpoints:
| Endpoint | Saves data as | Good for |
|---|---|---|
SQLiteDataEndPoint() |
A small database on the phone | Apps that show the data back, e.g. “your steps this week” |
FileDataEndPoint() |
Text files (JSON), zipped | Handing the data to a researcher |
Choosing the endpoint
Section titled “Choosing the endpoint”The protocol from Step 1 already uses SQLiteDataEndPoint(). To save
files instead, change only that line:
final protocol = SmartphoneStudyProtocol( name: 'My first study', dataEndPoint: FileDataEndPoint(),);Getting the data off the phone
Section titled “Getting the data off the phone”The data lives in the app’s private folder:
- Database:
carp-data, in the app’sdatabasesfolder. - Files:
carp/deployments/<deployment id>/data/, in the app’s documents folder.
To copy it to your computer:
- Android: in Android Studio, open Device Explorer and go to
data/data/<your app id>/. The database is indatabases/, files inapp_flutter/carp/. - iPhone: add
UIFileSharingEnabled=YEStoInfo.plist, plug the phone into a Mac, and open it in Finder → Files.
When to move on
Section titled “When to move on”Local storage is perfect for trying things out. For a real study you usually want data to arrive centrally without touching each phone. Then look at CAWS or your own server.
More detail: Data Managers.