Getting the CIQ version of the current device

Hello all.

I am developing an application that provides optional use of the gyroscope. At some point, I want to add a conditional statement of the form:

if(Device's CIQ version >= 3.3.0 && There's a gyro){
gyro values = whatever;
}else{
gyro values = 0;
}

I would really appreciate if someone could point me out how to properly do this type of things, since I would like my app to be compatible with older devices while giving better capabilities in new ones.

Thank you in advance