Background Data Collection

Data collection from most data sources in Ethica happens behind the scenes and without any participant involvement. After participants join your study and consent to its terms, if your study involves any of the automated data sources, Ethica will be continuously running on participant's phone, capturing data, encrypting them, and uploading them to the server.

While this is very useful to minimize participants’ burden and prevent Hawthorne effect, it goes against how most apps work. Both Android and iOS are designed such that when an app is not used by the user very often, the operating system stops and terminates it.

There are many factors which determine if and when the operating system should terminate an app, including but not limited to:

  • How much resources (e.g. battery or processing power) is the app using?
  • The version of the Android or iOS.
  • How much battery has remained?
  • Is there any intensive important app currently running (e.g. Skype video call)?
  • Make and model of the phone.

Based on these and other similar factors, Android and iOS might decide to terminate Ethica in order to free space for other more important apps. This in turn leads to incomplete data for your study.

We are always working to prevent app termination like this as much as possible. For the most part, you don't have to be worried about the details. At the same time, there are a few items discussed below which you need to be aware of in order to improve the data quality.

Keeping the Study Light

One of the important factors which cause an app to be terminated is the amount of resources it consumes. If the data sources you monitor for your study generate lots of data, Ethica will use more resources for the storage, encryption, compaction, and upload. This, in turn, will increase the chances of app termination. Therefore, it's very important for you to make sure your study only collects data from the necessary data sources.

Not all data sources generate the same size of data. For example, the pedometer generates a record every time a step is being captured, or GPS generates less than 50 records once every 5 minutes (a cycle). But some data sources such as Accelerometer, Gyroscope, Magnetometer, and other software- or hardware-based motion sensors generate thousands of records per cycle. Using such data sources in your study can increase the chance of the app being terminated.

In most cases, it's better to replace raw motion-sensor data (accelerometer, magnetometer, gyroscope, linear acceleration, gravity, and orientation) with their high-level equivalent data sources (motion-based activity recognition and pedometer). They can provide you data which is easier to analyze, and multiple orders of magnitude smaller in volume.

Even if you have to collect raw motion-sensor data, you probably need either the raw data from hardware (i.e. accelerometer, magnetometer, and gyroscope) or software-based sensors (i.e. linear acceleration, gravity, and orientation). Collecting all these sensors is almost always unnecessary as the software-based sensors can be derived from the raw data from hardware.

Background Activity in iOS

iOS is very strict on applications that perform background activity. In the App Store's App Review guidelines, Apple has defined a few categories, and only apps in those categories are allowed to perform any background activity. Unfortunately, research applications are not one of those categories, though location-aware applications are. In other words, while an application is actively using GPS, it can remain alive in the background and perform other tasks as well.

Ethica uses the category of "GPS-based apps" to remain active while not visible. That means it requires to actively use GPS in order to perform any task in the background. Therefore, if your study uses continuous monitoring of data sources, whether including GPS or not, Ethica will ask the participant for GPS permission:

Ethica App for iOS Requesting GPS Permission for Background Activity

If your study does monitor GPS, Ethica will capture accurate GPS records and upload them periodically together with other data sources. If your study does not require GPS, Ethica "pretends" to be using GPS by asking for very coarse GPS location, but it does not store nor upload those GPS data. This allows Ethica to remain active in the background to record and upload other requested data sources while minimizing battery consumption.

Handling App Termination in iOS

Ethica in iOS automatically detects if it's been terminated by the iOS operating system or not. If yes, it shows a message to the user asking them to open Ethica. Clicking that notification will simply open the Ethica app which is enough for Ethica to resume its operation. Ethica only sends one notification when it detects the app is terminated. If the user discards this message, at the moment Ethica will not send any additional reminder. If the user opens the Ethica app and iOS terminates the app again, Ethica will prompt another notification to the user.

Ethica App for iOS Notifies Participant After Termination

Background Activity in Android

Android handles background applications differently than iOS. Therefore, the model described for Ethica iOS does not apply to Android users. In Android, applications who wish to run continuously in the background are required to have a Sticky Notification: a permanent notification which is shown on the top of the screen like normal Android notifications but cannot be dismissed by the user.

Ethica App for Android Showing a Sticky Notification

Such notifications tell Android "this application is performing an important task for the user, and it should not be terminated as long as possible".

Sticky Notifications can be annoying for some users and might force them to drop out of the study. Therefore Ethica allows users to disable Sticky Notifications through Ethica Settings if they choose to. Of course, disabling Sticky Notifications will make the app subject to termination by Android, and can impact the data collection for the study. While Ethica informs the user about such impact, it respects their choice if they decide to disable Sticky Notifications.

Ethica App Allows Participants to Decide Whether Sticky Notifications
Should be Used or Not

Battery Optimization

The behaviour of the phones we explained above, where Android and iOS terminate the apps that is not used by the user recently, is called Battery Optimization. Android allows users to disable Battery Optimization for their apps. When a participant joins your study using his or her Android phone, Ethica shows them a notification and asks them to disable the Battery Optimization for the Ethica app:

Ethica instructs participants to disable Battery Optimization

Clicking on this notification will open the Battery optimization page. The participant should first open the dropdown on the top of the screen and select All apps:

Battery Optimization screen - All apps option

In the list of all apps, the participant should search and find Ethica and tap on it, and then choose Don't Optimize in the dialog that opens. Pressing Done will save this setting and excludes Ethica from battery optimization on this phone. This in turn will allow Ethica to run and operate in the background as expected:

Battery Optimization screen - Dont Optimize option

While the above setting exist on all Android devices, not all Android manufacturers, such as Huawei or Samsung, respect this settings. Different manufacturers often have their own settings to disable Battery Optimization.

When Ethica app detects it's not operating as expected, it assumes such manufacturer settings prevents the operation. Therefore it shows instructions to the participants relative to the type of phone they are using. You can also find these manufacturer-specific settings in the following sections.