Questions tagged [react-native-sensors]
17 questions
4
votes
1 answer
How can I detect that the device was rotated 360deg given (x,y,z) gyroscope?
I am using react-native-sensor to grab the raw data from the sensor.
setUpdateIntervalForType(SensorTypes.gyroscope, 100)
gyroscope.subscribe(({ x, y, z, timestamp }) => {
let pitch = Math.atan2(-x, -z) * 180 / Math.PI;// In degrees
let roll =…

Salman500
- 1,213
- 1
- 17
- 35
4
votes
3 answers
Smooth Orientation Compass using react-native-sensors's Magnetometer
I'm developing a compass app using react-native-sensors magnetometer. I'm getting the correct values and the compass is working perfectly, the main problem is the fast update of the compass, the direction keeps changing too frequently and the change…

Abdullah Yahya
- 119
- 1
- 10
3
votes
0 answers
How to calculate G-force, Harsh Braking and Acceleration when I have 'x , y , z' data?
I have got raw data x, y, z but I don't know how to calculate G-force, Harsh Braking, and Acceleration. I am developing an app where I need to gather data of Harsh Braking, and Acceleration, So can you please help me to find a way to…

Rahul Raj
- 31
- 3
2
votes
0 answers
background fetch not working with accelerometer in react native expo
im using below code to fetch the accelerometer values when my app is running in the background
i have added the below code ouside of the app component
TaskManager.defineTask('firstTask', async ({ data, error }) => {
if (error) {
// Error…

Suhail Misbah
- 11
- 2
2
votes
1 answer
How to substract the gravity from accelerometer values in React Native Sensors
From the API docs
It might be interesting to note that the gravity of the earth is not removed from the sensoric values. Dependening on the position of the phone you will need to substract this from the values if you are interested in the raw…

Daniel Schmidt
- 11,605
- 5
- 38
- 70
1
vote
0 answers
Pedometer algorithm doesn't count steps properly using accelerometer data
I am using react-native and I want to count the steps of the user like Samsung Health step indicator.
I am using react-native-sensors library to access accelerometer data.
I followed this tutorial for pedometer algorithm, implemented in…

Güney
- 91
- 2
- 9
1
vote
1 answer
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…

kenobi91
- 75
- 1
- 4
1
vote
2 answers
Error: Native Modules for sensors not available. Did react-native link run successfully?
I am new on React Native, could you helpe me? I have just installed the react-native-sensors(Yarn add --save react-native-sensors), then I imported on my project(import { Accelerometer } from "react-native-sensors";) but I receive this message…
0
votes
1 answer
Pedometer for Expo React Native
Is there a best recent pedometer library that supports the expo react native project? I'm now using expo-sensors. however, it appears that it is not yet supported on Android. Thanks ahead of time.
Here's what I got when I tried it

pavankommi
- 26
- 4
0
votes
0 answers
How to monitor the movement of the mobile phone ? (React Native or Js)
When the user starts his mobile phone at a certain point as the starting position, how can i get the trajectory of the mobile phone movement?
The function I expected to implement is: users can use his mobile phone as a brush.
I am using React Native…

Cao YongFeng
- 71
- 8
0
votes
0 answers
React Native sensor mangetometer compass resets after certain degree of rotation
I am using react-native-sensors mangetometer to create a compass based application.
There are 2 questions that i need help on :- 1
The react native sensor magnetometer by default points 0 degrees at east where as it should be pointing to 0 degree…

Soumil_13
- 17
- 4
0
votes
1 answer
React native sensor data retrieval unmounted comp. warning
I am building an app that can get the speed of my cell phone every time I move it. I get updates to this value but also I can see the next warning:
"Warning: Can't perform a React state update on an unmounted component. This is a no-op, but it…

Jose Cabrera Zuniga
- 2,348
- 3
- 31
- 56
0
votes
1 answer
react-native-sensors Error: Native modules for sensors not available. Did react-native link run successfully?
Thanks for any help, getting error message "Error: Native modules for sensors not available. Did react-native link run successfully?" when running npx react-native start
npx react-native run-android gives this error: > Task :app:processDebugManifest…

Bobski
- 1
- 1
0
votes
1 answer
Can I make dice rolling with gyroscope in React Native?
So, the idea is that there are several dice on the screen and the user needs to shake their phone to roll the dice (or push a button in case they don't have a gyroscope in their phone). The dice should be banging on the screen "walls" like they're…

Christine H.
- 143
- 2
- 7
0
votes
1 answer
How to save React Native phone sensor data to an array without using state arrays (getting Maximum update depth exceeded)?
I'm having some trouble figuring out how to handle sensor data in React Native. My goal is to get phone sensor data for a limited time (let's say 10 seconds) and after completion save the list obtained to local database. However pushing new…

Triin Kask
- 1
- 3