A modern smartphone is not just a computing device, but a set of powerful sensors. Camera, accelerometer, gyroscope, NFC, face scanner — all of this is available to developers through platform APIs. Hardware features allow you to create applications that interact with the physical world: from fitness trackers to augmented reality games. In this article, we will cover all the main sensors and APIs for iOS and Android. For more details, see the official Android Sensors documentation.
Key Takeaways
Smartphone hardware features include dozens of sensors that collect data about the environment and device position. This data is available through Sensors API (Android) and Core Motion (iOS). Sensors are divided into three categories: motion sensors (accelerometer, gyroscope), position sensors (magnetometer), and environmental sensors (barometer, light, temperature).
The accelerometer measures device acceleration along three axes (x, y, z) in m/s². It is used for: screen orientation detection (auto-rotate), step counting (pedestrian navigation), gesture recognition (shake to undo), tilt-controlled games. Android Sensor.TYPE_ACCELEROMETER and Core Motion CMMotionManager (iOS) provide raw data at up to 200 Hz.
The gyroscope measures the angular velocity of device rotation along three axes (rad/s). Unlike the accelerometer, the gyroscope is not affected by gravity, making it ideal for tracking rotations. Applications: video stabilization, VR/AR applications, indoor navigation, game controllers. Sensor.TYPE_GYROSCOPE (Android) and CMMotionManager (iOS) are the main APIs.
The magnetometer measures the Earth's magnetic field along three axes (µT) and functions as an electronic compass. It is used in navigation applications to determine direction to north. The magnetometer is sensitive to interference from metal objects and speakers; calibration is required (the characteristic figure-eight motion). Sensor.TYPE_MAGNETIC_FIELD — Android API.
Barometer measures atmospheric pressure (hPa) and is used to determine altitude above sea level with accuracy up to 1 meter. Proximity Sensor turns off the screen when the phone is held to the ear during a call. Ambient Light Sensor adjusts screen brightness. All these sensors are accessible through the unified SensorManager (Android) or CMMotionManager (iOS) for most motion sensors.
The camera is one of the most in-demand hardware components. On Android, access is through CameraX (modern Jetpack API) or Camera2 (low-level API). CameraX automatically handles the lifecycle, supports Preview, ImageCapture, ImageAnalysis (ML frame analysis), and VideoCapture. On iOS, the camera is available through AVFoundation: AVCaptureSession manages capture, AVCaptureDevice configures parameters (focus, ISO, white balance).
The microphone is used for audio recording, voice control, and speech recognition. On Android — MediaRecorder or AudioRecord; on iOS — AVAudioRecorder. Access to the camera and microphone requires user permission: Manifest.permission.CAMERA and RECORD_AUDIO (Android), NSCameraUsageDescription and NSMicrophoneUsageDescription (iOS) — strings in Info.plist describing the reason for use.
At IT Sectr, we have implemented over 20 projects with custom cameras: from QR code scanners to applications with AR filters. Key takeaway: on Android, CameraX saves weeks of development compared to Camera2, while on iOS, AVFoundation gives full control over shooting parameters. Example of basic image capture via CameraX:
class CameraFragment : Fragment() {
private lateinit var imageCapture: ImageCapture
fun startCamera() {
val processCameraProvider =
ProcessCameraProvider.getInstance(requireContext())
processCameraProvider.addListener({
val cameraProvider = processCameraProvider.get()
val preview = Preview.Builder()
.build()
.also {
it.setSurfaceProvider(viewFinder.surfaceProvider)
}
imageCapture = ImageCapture.Builder()
.setCaptureMode(ImageCapture.CAPTURE_MODE_MINIMIZE_LATENCY)
.build()
val cameraSelector = CameraSelector.DEFAULT_BACK_CAMERA
cameraProvider.bindToLifecycle(
this, cameraSelector, preview, imageCapture
)
}, ContextCompat.getMainExecutor(requireContext()))
}
}
Biometric hardware features allow users to log into an application using a fingerprint or face. iOS uses Face ID (TrueDepth camera, 30,000 invisible dots) and Touch ID (capacitive fingerprint scanner). Android uses BiometricPrompt, which combines fingerprint scanner (capacitive or ultrasonic) and Face Unlock (camera + ML). Face ID is more secure than Touch ID: probability of match 1:1,000,000 vs 1:50,000.
NFC (Near Field Communication) is a wireless communication technology with a range of up to 10 cm. It is used for: contactless payments (Google Pay, Apple Pay), reading NFC tags (smart posters, business cards), verification (documents, tickets), data transfer (Android Beam — deprecated). Core NFC (iOS) and NfcAdapter (Android) are the main APIs. On iOS, NFC is available for reading only (except for Apple Pay payments).
Bluetooth/BLE (Bluetooth Low Energy) — for connecting external devices: headphones, fitness bracelets, medical sensors, smart locks. Core Bluetooth (iOS) and android.bluetooth (Android) — APIs for scanning, connecting, and data exchange. BLE is energy efficient: a device can run on a battery for years. On iOS, background BLE operation requires enabling Background Modes → Uses Bluetooth LE accessories.
Health hardware features: HealthKit (iOS) — Apple's framework for health data aggregation. Users grant permission to read and write specific data types: steps, heart rate, sleep, calories, weight, blood pressure. All data is stored in a protected repository and synced via iCloud. HealthKit provides a unified interface for writing HKQuantitySample and reading via HKSampleQuery or HKStatisticsQuery.
Google Fit — Google's platform for fitness data on Android. The API is divided into two sets: Sensors API (real data from device sensors — steps, calories) and History API (reading/writing historical data). Google Fit also aggregates data from other fitness apps (Strava, Runkeeper) via authorization. On iOS, Google Fit is available through the REST API.
Core Motion (iOS) — a framework for working with motion sensors without a dedicated chip: accelerometer, gyroscope, pedometer (CMPedometer), altimeter (CMAltimeter). CMPedometer counts steps, distance traveled, pace, and flights climbed. On Android, similar capabilities are provided by Sensor.TYPE_STEP_COUNTER and Step Detector. All fitness data requires explicit user consent.
Augmented reality (AR) and on-device machine learning represent the pinnacle of smartphone hardware capabilities. ARKit (Apple, iOS 11+) uses the camera, gyroscope, accelerometer, and LiDAR (on Pro models) for tracking the surrounding space. ARCore (Google) is the Android equivalent with plane tracking, image recognition, and lighting estimation. Both frameworks use Visual Inertial Odometry (VIO) — a combination of camera and inertial sensors.
ML Kit (Google) — SDK for machine learning on Android and iOS. Includes ready-made APIs: text recognition (OCR), barcode scanning, face recognition, pose detection, object tracking, image text recognition, and natural language processing. ML Kit works entirely on-device — data is not sent to the server, ensuring privacy and offline functionality.
Core ML (Apple) — a framework for integrating ML models into iOS applications. Models (mlmodel) are converted from TensorFlow, PyTorch, or Keras via Core ML Tools. Vision — a framework for computer vision: face detection, text, barcodes, horizontal alignment. Combining Vision and Core ML allows building real-time ML pipelines: frame capture → Vision analysis → Core ML prediction → UI update — all on-device with latency under 50 ms.
Frequently Asked Questions
A modern smartphone contains an accelerometer, gyroscope, magnetometer (compass), barometer, proximity sensor, ambient light sensor, fingerprint scanner, camera, microphone, NFC, Bluetooth, Wi-Fi, GPS. Flagship models also have LiDAR, heart rate monitor, and temperature sensor.
Face ID is facial biometric authentication using the TrueDepth camera (30,000 dot projection). Touch ID is fingerprint authentication via a capacitive scanner. Face ID is more secure (1 in 1,000,000 vs 1 in 50,000) and works without contact.
The modern approach is CameraX (Jetpack library). CameraX simplifies camera work: it automatically manages the lifecycle, supports Preview, ImageCapture, ImageAnalysis, and VideoCapture. For legacy projects, the Camera2 API is used.
NFC allows you to: read and write NFC tags (smart posters, business cards), make contactless payments (Google Pay, Apple Pay), transfer data between devices, verify documents, open doors, use transit cards. On iOS, NFC is available for reading only (except Apple Pay).
ARKit is Apple's framework for augmented reality on iOS. ARCore is Google's equivalent for Android. Both support plane tracking, image recognition, and lighting estimation. ARKit uses LiDAR (on iPad Pro/iPhone Pro) for more accurate positioning.
Summary
We will develop a mobile application turnkey
IT Sectr creates iOS and Android applications for startups and businesses since 2017. We will advise you and propose the best solution.