Is there a way to read input from a single sensor from c++?

I’ve been told that InputMotionState works only in phones with accelerometer AND gyroscope, how can I read input only from the accelerometer in a phone without gyroscope?