You have to register for sensor type accelerometer and then see how to calculate the tilt at How to measure the tilt of the phone in XY plane using accelerometer in Android
For your purpose if the inclination in the above link is not zero (give or take a few degrees) then your device is lifted up.