How to access the gyro in Unity? Who can offer me a detailed solution?

I need to use the data from the gyro in the Android phone. But it seems very troublesome to do it.
Anyone can tell me how? Need to write a java? Where to put the java file? I want detailed code. Thank you.

Input.Gyro - check the docs.

The easiest way would possibly be to use a readymade plugin. Prime31 has one, but Prefrontal Cortex has one too which provides access to all sensors Android is capable of, so there would be no work left for you :).

You can find it in the forums: goo.gl/8ZIM7