How to use Quaternions to detect slight tilts in Android
I am working on a app where I have to detect device tilts from the user. The tilts could be around any axis (Left tilt, Right Tilt, Front Tilt, Back Tilt and Sideways Tilt). I want the tilts to be detected agnostic to the user orientation ie, I need to be able to detect the tilt, irrespective of how the user positions himself (Sitting, Standing, Sleeping, Walking, etc). How do I achieve this. I currently use the android rotation vector to generate rotational quaternions. How do I use these values to detect the tilts. Code would be appreciated. Thanks in advance.