0

I have an activity with :

public class MyActivity extends Activity implements SensorEventListener, GestureDetector.BaseListener

I implement the functions

@Override
public boolean onGenericMotionEvent(MotionEvent event)
{
    Log.d("MOTION", "MOTION DETECTED");
}

@Override
public void onSensorChanged(SensorEvent event) {
    Log.d("MOTION", "SENSOR DETECTED");
}

onGenericMotionEvent works fine, but onSensorChanged is never called, am I missing something ?

Pull
  • 2,236
  • 2
  • 16
  • 32

1 Answers1

1

Have you properly registered your Activity as a listener within your SensorManager? You should checkout the Compass sample which makes use of some of the sensors on Glass.

The class you'd be interested in is the OrientationManager:

mSensorManager.registerListener(mSensorListener,
        mSensorManager.getDefaultSensor(Sensor.TYPE_ROTATION_VECTOR),
        SensorManager.SENSOR_DELAY_UI);
Alain
  • 6,044
  • 21
  • 27