Please provide the following:
- SDK Version: 42.0.0
- Platforms(Android/iOS/web/all): Android
Hi,
I’ve installed the expo-sensors
package and tried to use both DeviceMotion
and Gyroscope
.
With both, I get isAvailable
resolved to true
by calling .isAvailableAsync
, but the event listenter will never be triggered.
Example code (result ist the same for both DeviceMotion and Gyroscope). data
will always stay null
.
const [data, setData] = useState(null)
useEffect(() => {
(async () => {
const isAvailable = await DeviceMotion.isAvailableAsync()
if(isAvailable) {
const subscription = DeviceMotion.addListener((data) => {
setData(data)
})
return subscription.remove()
}
})()
}, [])
Thanks for your help,
Florian