Sensors with Android 5.1

If I connect a gyroscope, accelerometer, magnetometer, or any other type of sensor, how would I connect it to the BPI-M3? I am using Android 5.1 on this, so how would I get Android to read values from the sensor and where would I find drivers for Android to read these sensors?

Using java programming on android and phyton on linux look at Gpio android bpi-m2