'react-native-sensors All three sensors reading

This isn't a problem, rather it is a question. Is there a way to get data from all three sensors at once (accelerometer, gyro, magnetometer) or is it just enough to set update interval for all three the same value. Like this

setUpdateIntervalForType(SensorTypes.accelerometer, 100); setUpdateIntervalForType(SensorTypes.magenetometer, 100); setUpdateIntervalForType(SensorTypes.gyroscope, 100);

const subscription = accelerometer.subscribe(({ x, y, z, timestamp }) => console.log({ x, y, z, timestamp }) );

const subscription1 = gyroscope.subscribe(({ x, y, z, timestamp }) => console.log({ x, y, z, timestamp }) );

const subscription2 = magenetometer.subscribe(({ x, y, z, timestamp }) => console.log({ x, y, z, timestamp }) );


Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source