This uses your device's gyroscope to find the angle α, and then uses simple trigonometrics to find the height, using:
tan(α) * d = h