Using Android’s GPS and sensor permission to calculate the users height

Smartphones have become indispensable tools in modern life, used for communication, work, and even entertainment. The average person checks their phone around 150 times a day, often without even realizing it. Given the increasing sophistication of smartphone sensors, this project explores whether a smartphone can deduce a user’s height using data collected as they walk.

Why this project?

The inspiration for this project stems from the increasing awareness of data collection and surveillance by tech companies. Smartphones are equipped with various sensors that can gather personal information. This project aims to evaluate how sensor data from smartphones can be used to collect data about the user. By focusing on height estimation, the project seeks to understand the capabilities and limitations of smartphone sensors in inferring personal attributes.

How we did it

To investigate this, an Android app was developed to collect data from the smartphone’s GPS and software-based pedometer while the user was walking. The app calculates the user’s average step length and then estimates their height using a ratio called SHR (Step length to Height Ratio). The process involves:

  • Data Collection: The Android app was designed to continuously gather data from the phone’s GPS and pedometer while the user is walking. The requestLocationUpdates() function was used to receive updates about the user’s location at specific intervals.
  • Distance Calculation: The distanceBetween() function was employed to calculate the distance between two coordinate instances using the WGS84 reference system.
  • Step Detection: The accelerometer was used to measure changes in acceleration, which helps in detecting steps.
  • SHR Calculation: After completing a test, the app calculates the user’s average step length. Height is then estimated by dividing the average step length by the SHR.
  • Testing: The app was tested by multiple participants, and their data was recorded and analyzed.

How it went

The accuracy of the app varied, with height estimations off by as much as 0.97 meters, with an average error of 0.29 meters. Several factors influenced the results:

Sensor Accuracy: Variations in the accuracy of sensor data can impact the results:

  • Smartphone Coverage: The phone’s GPS accuracy is affected by coverage, which depends on proximity to cell towers and potential signal blockage.
  • Electromagnetic Interference: Electromagnetic interference can also affect the accuracy of sensor data.
  • Walking Speed: A faster speed results in a higher SHR value, while a slower speed results in a lower SHR value.
  • The initial delay: There is an initial delay in receiving the first location update when the app registers a request using requestLocationUpdates().

And what the heck does this mean

Despite the uncertainties, the study indicates a potential for smartphones to estimate a user’s height with a reasonable level of accuracy. The app’s performance is optimal when the test subject walks at a speed of between 1.3-1.4 m/s. At this speed, the results deviate by a maximum of 7 cm from the test subjects’ actual height. The project highlights the importance of responsible data collection and the need for users to be aware of how their personal information can be inferred from sensor data. Further development could enhance the app’s precision and expand its capabilities. For instance, implementing the algorithm in the background of other apps, without the user’s awareness.

Take a look for yourself

If you’re interested, here is the source code of the app we developed (in Kotlin).