Is it possible to detect current orientation of an android device using sensors like Gyroscope? By orientation I mean whether the device is held vertical to ground or placed horizontally on a surface etc...
Thanks in advance.
Is it possible to detect current orientation of an android device using sensors like Gyroscope? By orientation I mean whether the device is held vertical to ground or placed horizontally on a surface etc...
Thanks in advance.
The current configuration, as used to determine which resources to retrieve etc, as available from the Resources' Configuration object as:
getResources().getConfiguration().orientation
Try this:
Activity.getResources().getConfiguration().orientation
It will returns current activity orientation
For more information click Here
Yes, You can use Sensor's data to analyse the position of a device.
Please refer to the standard documentation on how to use gyroscope: http://developer.android.com/reference/android/hardware/SensorEvent.html
Also, a possible duplicate of: