Created
August 3, 2020 10:11
-
-
Save Younes-Charfaoui/d204a7987c75b1971fa7e4b77d99ff4e to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| private lateinit var sensorManager: SensorManager | |
| override fun onCreate(savedInstanceState: Bundle?) { | |
| super.onCreate(savedInstanceState) | |
| setContentView(R.layout.activity_main) | |
| // initializing the sensor manager | |
| sensorManager = getSystemService(Context.SENSOR_SERVICE) as SensorManager | |
| // getting the list of all the availabale sensors in the current device | |
| val deviceSensors: List<Sensor> = sensorManager.getSensorList(Sensor.TYPE_ALL) | |
| deviceSensors.forEach { sensor -> | |
| Log.d("SENSORS", "Sensor Name: ${sensor.name}") | |
| } | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment