Mobile sensing on iOS and Android: what is technically possible and what is not

iPhones and Android devices often deliver different data for the same data type: Android mostly single events in real time, the iPhone only summaries for screen time and keyboard, about 24 hours late and only with approval from Apple. Your study design has to account for this if you analyse both platforms.

Updated on

Why do the platforms differ?

A research app can only record what the operating system releases. Apple and Google draw this line differently. iOS keeps background apps on a short leash and releases sensitive usage data only through a dedicated research interface. Android allows more, requires special permissions in return and leaves device manufacturers free to add their own battery-saving rules.

In a feasibility study, data arrived for only 55% (Android) and 45% (iOS) of scheduled scans on average (Boonstra et al., 2018). An analysis of six studies with 211 participants found less missing GPS data on iPhones than on Android devices (Kiang et al., 2021). Which platform does better therefore depends on the sensor, the app and the device. In personality, iOS and Android users hardly differ: in two samples (N = 1,081 and N = 2,438), Götz et al. (2017) found only a few small differences, most of which disappeared once sociodemographic variables were controlled for.

What works per data type? Current state in PULSE

'With SensorKit' means: only with approval from Apple for the specific research project.

Data typeiPhoneAndroidNote
LocationyesyesNeeds the 'Always' permission. Android throttles positioning when the device lies still for a long time
StepsyesyesThe iPhone backfills up to 7 days. Android only counts while the app runs in the background
Activity (still, walking, running, cycling, vehicle)yesyesThe iPhone reports three confidence levels, Android one
Motion sensorsacceleration continuously, rotation and magnetic field only while the app runscontinuouslyiOS keeps acceleration for 3 days and the app fetches it later
Individual callsyes, including internet callsyes, mobile network onlyStart, duration and direction. No phone numbers, no content
Call statisticsaggregated, after about 24 hours, with SensorKitnoIncludes the number of distinct contacts
Screen time and app useaggregated per quarter of an hour, after about 24 hours, with SensorKitlive, per event and appThe iPhone provides app categories, Android the individual apps
Keyboardaggregated, after about 24 hours, with SensorKitlive, including typed textAndroid through an accessibility service, password fields are excluded
MusicyesyesAndroid needs notification access
Health dataApple HealthHealth ConnectNo live data. Values from a watch arrive only after it has synced with the phone
Wi-Ficonnected networkconnected network, signal strength, number of nearby networksiOS does not release signal strength or nearby networks
Bluetoothin the background almost only connected devicesnearby devicesWith the screen off, Android shows only some of the devices
Ambient noise levelforeground onlyforeground and periodicNo audio recordings. Levels are not directly comparable between platforms
Ambient lightafter about 24 hours, with SensorKitliveOn the iPhone roughly one value every 5 minutes
Batteryyes, in 5% stepsyes, in whole per centHelps to explain data gaps
GarminyesyesParticipants connect their account, the data come from Garmin
SpotifyyesyesAccount connection, currently temporarily disabled

Background restrictions on the iPhone

iOS suspends most apps shortly after they move to the background. A suspended app does not run and receives no location updates until the system wakes it again (Apple, Core Location). For continuous recording, the 'Always' location permission and background app refresh are therefore important.

  • If participants close the app by swiping it away, recording stops until they open the app again.
  • In time-based location mode, iOS does not take a new fix while the device is stationary. The last position then appears several times in the data.

Apple SensorKit: approval and delay

SensorKit is Apple's interface for research data. On the iPhone, screen time, keyboard, ambient light and call statistics are available only through it. Apple grants access for research use only and reviews each study separately on the basis of a research proposal. For use in the field, Apple requires approval from an ethics board, and every data type collected has to appear in the consent form (Apple, Accessing SensorKit Data).

SensorKit holds newly recorded data for 24 hours before an app can fetch it. Apple's stated reason is to give people the chance to delete data they do not want to share (Apple, SRFetchRequest). Participants authorise each sensor separately in a system dialogue and can withdraw this at any time. The data arrive in aggregated form: for screen time per quarter of an hour with unlocked time, unlocks and use per app category, for the keyboard as metrics such as the number of words and corrections, typing speed and word counts per sentiment category. Content and individual apps cannot be identified.

Without approval a study still runs, but screen time, keyboard, ambient light and call statistics are then missing on iPhones. Android is unaffected.

Android: Doze, manufacturers and special permissions

On Android a sensing app runs as a service with a permanent notification. If the device lies still with the screen off for a longer time, Android enters Doze: network access and jobs are deferred to maintenance windows, Wi-Fi scans are not performed, and even the alarms designed for this state fire at most once every nine minutes per app (Android Developers, Doze). An app's own Wi-Fi scans are limited to one scan in 30 minutes for background apps (Android Developers, Wi-Fi scanning). For time-based location, a PULSE test in Doze yielded about 10 instead of 60 points per hour. As the device is stationary during this time, the last position can be carried forward.

Manufacturers add their own battery optimisation. Some stop background apps particularly quickly, for example Xiaomi, Huawei, OnePlus, Oppo and Vivo. On Samsung devices, too, positioning is throttled when the app is restricted in the battery settings. The site dontkillmyapp.com documents the behaviour per manufacturer and the settings required. An app can point this out, but it cannot check whether participants have changed the settings.

Several data types need special permissions on Android that participants enable by hand in the settings: usage access for app use, an accessibility service for the keyboard, notification access for music, and a separate permission so that Health Connect can be read in the background. If someone switches the accessibility service off again, keyboard data go missing without any notice.

Recommendations for study design

  1. Derive from your research question which features you need on both platforms, and check in the table whether both deliver them in a comparable form.
  2. Settle SensorKit early in your planning.
  3. Reduce features to a common level, such as screen time per day, and record operating system and device model as variables.
  4. Do not use delayed iPhone data for real-time triggers, and ask participants to open the app regularly.
  5. At enrolment, explain the permissions, the battery settings and that the app should not be swiped away.
  6. Before launch, test with devices on both platforms over several days, and SensorKit data types with at least one day of lead time.

Frequently asked questions

Can screen time be recorded on the iPhone for a research study?

Yes, but only through Apple SensorKit and therefore only with approval from Apple for the research project. The data arrive as reports per quarter of an hour with a delay of at least 24 hours and show app categories, not individual apps.

Can a research app record what participants type?

Not on the iPhone. There, only aggregated metrics such as number of words, corrections, typing speed and word counts per sentiment category are available, without content. On Android an app can use an accessibility service to record keystrokes, intervals and also the typed text, with password fields excluded. This belongs explicitly in the consent form.

Are phone numbers or conversations recorded for calls?

No. What is recorded is the start, end, duration and direction of a call, with no phone numbers and no content. Because the iPhone also reports calls made through messenger apps and Android mobile network calls only, call counts are not directly comparable.

Why is sensor data missing on some Android devices?

Often because of battery optimisation: Android defers measurements in Doze, and some manufacturers stop background apps under their own rules. It often helps to exempt the app from restrictions in the battery settings.

Are sensor data from iPhone and Android comparable?

For location, steps, activity and battery largely yes. For screen time, keyboard, calls, Bluetooth and noise level, the resolution, content or scale differ clearly. In those cases, compare within one platform or at the level of daily values.

With PULSE

The PULSE Research App records every data type in the table on both platforms to the extent that the operating system permits. In the admin panel you choose the modules per study and see which ones need SensorKit approval on iPhones; the Center for Computation of Human Behavior supports you with the request to Apple. Data stay encrypted on the device until they are transferred, and the app catches up after shorter offline periods. The pre-processed export contains coverage values, for example for location and steps, so that you can identify and report gaps. Which modules are available depends on the licence.

Further reading

Sources

  1. Apple Inc. (n.d.). SensorKit. Apple Developer Documentation. https://developer.apple.com/documentation/sensorkit
  2. Apple Inc. (n.d.). SRFetchRequest. Apple Developer Documentation. https://developer.apple.com/documentation/sensorkit/srfetchrequest
  3. Apple Inc. (n.d.). Accessing SensorKit Data. Apple Health Research. https://healthresearch.apple.com/resources/accessing-sensorkit-data/
  4. Apple Inc. (n.d.). Handling location updates in the background. Apple Developer Documentation, Core Location. https://developer.apple.com/documentation/corelocation/handling-location-updates-in-the-background
  5. Android Developers (n.d.). Optimize for Doze and App Standby. Google. https://developer.android.com/training/monitoring-device-state/doze-standby
  6. Android Developers (n.d.). Wi-Fi scanning overview. Google. https://developer.android.com/develop/connectivity/wifi/wifi-scan
  7. Don't kill my app! (n.d.). Urbandroid Team. https://dontkillmyapp.com/
  8. Boonstra, T. W., Nicholas, J., Wong, Q. J., Shaw, F., Townsend, S., & Christensen, H. (2018). Using mobile phone sensor technology for mental health research: Integrated analysis to identify hidden challenges and potential solutions. Journal of Medical Internet Research, 20(7), e10131. https://doi.org/10.2196/10131
  9. Kiang, M. V., Chen, J. T., Krieger, N., Buckee, C. O., Alexander, M. J., Baker, J. T., Buckner, R. L., Coombs, G., Rich-Edwards, J. W., Carlson, K. W., & Onnela, J.-P. (2021). Sociodemographic characteristics of missing data in digital phenotyping. Scientific Reports, 11, 15408. https://doi.org/10.1038/s41598-021-94516-7
  10. Götz, F. M., Stieger, S., & Reips, U.-D. (2017). Users of the main smartphone operating systems (iOS, Android) differ only little in personality. PLOS ONE, 12(5), e0176921. https://doi.org/10.1371/journal.pone.0176921