horizontal direction is judged by measuring the component forces of a piece of weight
(integrated by a weight and piezoelectric pieces) inside at two orthogonal directions.
Gravity sensor has been developed for several years.
Nowadays, in most mainstream smart phones,
gravity sensor has become the standard configuration of the mobile phones.