NeoLSN / cordova-plugin-gyroscope

Cordova Device Gyroscope Plugin
9 stars 14 forks source link

how to judge the orientation of iPhone after success call back #4

Open rahulsemwal opened 8 years ago

rahulsemwal commented 8 years ago

After success call back I got different kind of orientation objects and and I want to check whether the iPhone is in landscape or portrait orientation currently. success call back is below:

Orientation {x: 0.02584065205703885, y: -0.3507689419159716, z: -0.1126170930161808, timestamp: 1476258447743.268}

gutosantos82 commented 7 years ago

I guess accelerometer data will give you a better idea. The accelerometer is affected by gravity so the axis with a value close to 9/-9 is the one in which the device is pointing up/down, respectively.

NeoLSN commented 7 years ago

https://developer.android.com/guide/topics/sensors/sensors_motion.html#sensors-motion-gyro

rahulsemwal commented 7 years ago

thank you