Android Sensors Interview Questions
Motion, location, and sensor APIs.
50 questions in this topic · 8 sample questions below
Practice Sensors in the quiz engine
Sample questions
You call registerListener with SENSOR_DELAY_FASTEST. What does this actually guarantee about how often onSensorChanged fires?
Why: The SENSOR_DELAY_* constants are only hints to the framework; actual delivery depends on hardware, other listeners, and system load. It does not guarantee an exact rate, so the answer claiming a precise fastest rate is a common misconception.
TYPE_LINEAR_ACCELERATION differs from TYPE_ACCELEROMETER in what key way?
Why: Linear acceleration is a composite sensor giving device acceleration excluding gravity, whereas the raw accelerometer includes gravity. The claim that it reports only gravity describes TYPE_GRAVITY, not linear acceleration.
A developer assumes the raw accelerometer already subtracts gravity, so a still phone should read near zero on all axes. Why is that wrong?
Why: TYPE_ACCELEROMETER includes the gravity vector, so a resting device shows roughly 9.81 m/s^2 on the vertical axis. To get gravity-free values you must use TYPE_LINEAR_ACCELERATION or subtract the gravity estimate.
Which sensor type is a virtual or composite sensor derived from sensor fusion rather than a single physical chip?
Why: The rotation vector is a fused or virtual sensor combining accelerometer, gyroscope, and magnetometer data. The accelerometer, magnetometer, and barometer are all raw physical sensors.
What does maxReportLatencyUs in registerListener enable?
Why: maxReportLatency lets the sensor hardware batch samples in its FIFO and deliver them together, reducing wakeups and saving power. It does not change the sampling period nor cap callback duration.
A non-wakeup sensor is batching events while the CPU is asleep and the FIFO fills up. What happens?
Why: A non-wakeup sensor does not wake the application processor; if its FIFO fills while the CPU sleeps, older events are dropped or overwritten. A wakeup sensor, by contrast, wakes the CPU to guarantee no event loss.
What is the meaning of the timestamp field in a SensorEvent on modern Android?
Why: SensorEvent.timestamp is in nanoseconds referenced to boot (the elapsed-realtime clock), not the wall-clock epoch. Treating it as Unix epoch milliseconds is a frequent bug.
Your app reads TYPE_STEP_COUNTER and shows the returned value directly as steps this session, but it starts huge. Why?
Why: TYPE_STEP_COUNTER returns the total steps since boot; to get session steps you must record a baseline at start and subtract. It does not reset per app session.
Practice all 50 Sensors questions
These 8 are a sample. The full Sensors bank is scored, tracks your progress, and explains every answer.
More Android interview topics
- Android Hilt interview questions
- Android Coroutines & Flow interview questions
- Android Room interview questions
- Android Design Patterns interview questions
- Android Mobile System Design interview questions
- Android Coding Interview Patterns interview questions
- Android NDK interview questions
- Android Security interview questions
- Android Jetpack Compose interview questions
- Android Canvas & Animation interview questions
- Android CI/CD interview questions
- Android Git interview questions
- Android Unit Testing interview questions
- Android Kotlin interview questions
- Android Retrofit interview questions
- Android Architecture interview questions
- Android Android Framework interview questions
- Android Kotlin Multiplatform interview questions
- Android WorkManager & Background interview questions
- Android Performance & Memory interview questions