This tutorial assumes you are a beginner and want to understand the full app flow.
MainActivity checks whether the microphone permission is already granted. If it is not, the interface keeps the measurement button disabled and shows the permission button.
When the permission button is pressed, Android shows the standard microphone permission dialog. The result is forwarded to the view-model.
The view-model asks AndroidAudioPulseEchoDistanceMeasuringService to run one measurement attempt.
HighFrequencyPulseGenerator produces a short chirp whose frequency rises over time. A Hann window is applied so the signal starts and ends smoothly.
The measuring service starts recording first, waits for a short pre-roll window, then plays the pulse.
CorrelationBasedNearestReflectionDistanceEstimator correlates the known pulse with the recording and searches for the earliest reflection after direct coupling.
DistanceRadarView draws a simple scale, a phone marker, and a reflection marker positioned according to the measured distance.