package dev.kaderli.magsend

import android.content.Context
import android.hardware.Sensor
import android.hardware.SensorEventListener
import android.hardware.SensorManager
import android.os.Bundle

abstract class BaseSensorActivity : BaseActivity(), SensorEventListener {
  private lateinit var sensorManager: SensorManager;
  private lateinit var sensor: Sensor;

  override fun onCreate(savedInstanceState: Bundle?) {
    super.onCreate(savedInstanceState)
    sensorManager = getSystemService(Context.SENSOR_SERVICE) as SensorManager
    sensor = sensorManager.getDefaultSensor(Sensor.TYPE_MAGNETIC_FIELD);
    sensorManager.registerListener(this, sensor, SensorManager.SENSOR_DELAY_UI);
  }

  override fun onAccuracyChanged(sensor: Sensor?, accuracy: Int) {}
}
