Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Gyroscope event not triggered #25

Open
herdani opened this issue Dec 9, 2016 · 3 comments
Open

Gyroscope event not triggered #25

herdani opened this issue Dec 9, 2016 · 3 comments

Comments

@herdani
Copy link

herdani commented Dec 9, 2016

The listener 'Gyroscope' is never triggered, I have no errors at all, but nothing never happens. I suppose my code is Ok since all other sensors are working well. Tried on a Samsung and a Sony device. Any idea ?

import React, {DeviceEventEmitter} from 'react-native';

var mSensorManager = require('NativeModules').SensorManager;
mSensorManager.startGyroscope(100);
DeviceEventEmitter.addListener('Gyroscope', function(data) {
  // Got never here
});
@herdani
Copy link
Author

herdani commented Dec 9, 2016

Hint: While trying to debug (don't know Android nor Java, so quite hard), I found out that, in file
react-native-sensor-manager/android/src/main/java/com/sensormanager/GyroscopeRecord.java

if ((mGyroscope = mSensorManager.getDefaultSensor(Sensor.TYPE_GYROSCOPE)) != null) {

always returns null ...

@kennethjiang
Copy link

What's the solution?

I have the same problem. In my situation Orientation event is never triggered either, which could be related.

@kennethjiang
Copy link

Never mind. It turns out my Android device doesn't have a gyro or magnetometer. :(

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants