This is an example of reading Android sensor data via native c++ API, and a simple implementation from JNI.
// declare your own SensorEventListener
class MyListener: public NdkSensorEventListener{
public:
void onSensorChanged(ASensorEvent *event) override{ // do something }
}
NdkSensorManager* manager = NdkSensorManager();
manager->setListener(new MyListener());
// register accelerometer with 50 Hz.
manager->registerSensor({ASENSOR_TYPE_ACCELEROMETER}, 20000);
// unregister sensors
manager->unregister();