I am trying to create an application which reads data from digital compass. I tried to reuse the code from the book Professional Android Application Development but the IDE
You actually need to pass in a Senor object, not just the ID of it.
Sensor sensor = sensorManager.getDefaultSensor(Sensor.TYPE_ORIENTATION); sensorManager.registerListener(sensorListener, sensor, SensorManager.SENSOR_DELAY_FASTEST)