I'm working on an Android and iOS application for which it is important to understand if the device is resting on a horizontal surface or not. Is there a way to verify it programmatically? I was thinking of using the accelerometer but the sensor data vary slightly even if the device remains stationary on the surface.
PS. I mean that the device must be physically supported on a surface like a table and not for example in the hand. This only interests me if the application is in use.