Avoid using the geomagnetic sensor if you can, it's usually crap anyway.
As for the accelerometer, assuming the device is at rest (ie not accelerating in any direction), you should have an acceleration in one direction of slightly less than 10 (the exact value depends on where you are on earth, for example, here in central Sweden, it's 9.82, and 9.83 the poles, while only 9.78 at the equator) from the gravity. The sensors aren't that exact anyway, so I'd probably go with anything above 8. Anyway, that direction is down.
However, this assumes the device is either flat, standing or sideways. If you have any degrees of tilt between these that you wish to measure, you'll have to break out your math books and check for Pythagoras theorem and trigonometry.