Sensors Tutorial for Android: Getting Started | raywenderlich.com

In this sensors tutorial, you’ll learn about different types of sensors and how to use sensor fusion (accelerometer with magnetometer) to develop a compass.


This is a companion discussion topic for the original entry at https://www.raywenderlich.com/10838302-sensors-tutorial-for-android-getting-started

sensorManager.getDefaultSensor(Sensor.TYPE_MAGNETIC_FIELD)?.also { magneticField →
sensorManager.registerListener(this, magneticField, SensorManager.SENSOR_DELAY_NORMAL, SensorManager.SENSOR_DELAY_UI)
}

this is not working sensorManager.registerListener(param 1 should be listener in the example we have (this) in this scope this is a service not a listener. I think that is the problem let me know