Stay organized with collections
Save and categorize content based on your preferences.
SensorEventCallback
abstract class SensorEventCallback : SensorEventListener2
Used for receiving sensor additional information frames.
Summary
Public methods |
open Unit |
Called when the accuracy of the registered sensor has changed.
|
open Unit |
Called after flush() is completed.
|
open Unit |
Called when a sensor additional information frame is available.
|
open Unit |
Called when sensor values have changed.
|
Public constructors
SensorEventCallback
SensorEventCallback()
Public methods
onAccuracyChanged
open fun onAccuracyChanged(
sensor: Sensor!,
accuracy: Int
): Unit
Called when the accuracy of the registered sensor has changed.
Parameters |
accuracy |
Int: The new accuracy of this sensor, one of SensorManager.SENSOR_STATUS_* |
onFlushCompleted
open fun onFlushCompleted(sensor: Sensor!): Unit
Called after flush() is completed.
Parameters |
sensor |
Sensor!: The Sensor on which flush was called. |
onSensorAdditionalInfo
open fun onSensorAdditionalInfo(info: SensorAdditionalInfo!): Unit
Called when a sensor additional information frame is available.
onSensorChanged
open fun onSensorChanged(event: SensorEvent!): Unit
Called when sensor values have changed.
Content and code samples on this page are subject to the licenses described in the Content License. Java and OpenJDK are trademarks or registered trademarks of Oracle and/or its affiliates.
Last updated 2025-02-10 UTC.
[[["Easy to understand","easyToUnderstand","thumb-up"],["Solved my problem","solvedMyProblem","thumb-up"],["Other","otherUp","thumb-up"]],[["Missing the information I need","missingTheInformationINeed","thumb-down"],["Too complicated / too many steps","tooComplicatedTooManySteps","thumb-down"],["Out of date","outOfDate","thumb-down"],["Samples / code issue","samplesCodeIssue","thumb-down"],["Other","otherDown","thumb-down"]],["Last updated 2025-02-10 UTC."],[],[],null,["# SensorEventCallback\n\nAdded in [API level 24](https://developer.android.com/guide/topics/manifest/uses-sdk-element.html#ApiLevels)\n\nSensorEventCallback\n===================\n\n*** ** * ** ***\n\nKotlin \\|[Java](/reference/android/hardware/SensorEventCallback \"View this page in Java\") \n\n```\nabstract class SensorEventCallback : SensorEventListener2\n```\n\n|---|-------------------------------------------|\n| [kotlin.Any](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-any/index.html) ||\n| ↳ | [android.hardware.SensorEventCallback](#) |\n\nUsed for receiving sensor additional information frames.\n\nSummary\n-------\n\n| Public constructors ||\n|----------------------------------------------------------|---|\n| [SensorEventCallback](#SensorEventCallback())`()` \u003cbr /\u003e |\n\n| Public methods ||\n|-----------------------------------------------------------------------------------|-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|\n| open [Unit](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-unit/index.html) | [onAccuracyChanged](#onAccuracyChanged(android.hardware.Sensor,%20kotlin.Int))`(`sensor:` `[Sensor](/reference/kotlin/android/hardware/Sensor)!`, `accuracy:` `[Int](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-int/index.html)`)` Called when the accuracy of the registered sensor has changed. |\n| open [Unit](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-unit/index.html) | [onFlushCompleted](#onFlushCompleted(android.hardware.Sensor))`(`sensor:` `[Sensor](/reference/kotlin/android/hardware/Sensor)!`)` Called after flush() is completed. |\n| open [Unit](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-unit/index.html) | [onSensorAdditionalInfo](#onSensorAdditionalInfo(android.hardware.SensorAdditionalInfo))`(`info:` `[SensorAdditionalInfo](/reference/kotlin/android/hardware/SensorAdditionalInfo)!`)` Called when a sensor additional information frame is available. |\n| open [Unit](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-unit/index.html) | [onSensorChanged](#onSensorChanged(android.hardware.SensorEvent))`(`event:` `[SensorEvent](/reference/kotlin/android/hardware/SensorEvent)!`)` Called when sensor values have changed. |\n\nPublic constructors\n-------------------\n\n### SensorEventCallback\n\n```\nSensorEventCallback()\n```\n\nPublic methods\n--------------\n\n### onAccuracyChanged\n\nAdded in [API level 24](https://developer.android.com/guide/topics/manifest/uses-sdk-element.html#ApiLevels) \n\n```\nopen fun onAccuracyChanged(\n sensor: Sensor!, \n accuracy: Int\n): Unit\n```\n\nCalled when the accuracy of the registered sensor has changed.\n\n| Parameters ||\n|------------|-----------------------------------------------------------------------------------------------------------------------------------------------------|\n| `accuracy` | [Int](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-int/index.html): The new accuracy of this sensor, one of `SensorManager.SENSOR_STATUS_*` |\n\n**See Also**\n\n- [android.hardware.SensorEventListener#onAccuracyChanged(Sensor, int)](/reference/kotlin/android/hardware/SensorEventListener#onAccuracyChanged(android.hardware.Sensor,%20kotlin.Int)) \n\n### onFlushCompleted\n\nAdded in [API level 24](https://developer.android.com/guide/topics/manifest/uses-sdk-element.html#ApiLevels) \n\n```\nopen fun onFlushCompleted(sensor: Sensor!): Unit\n```\n\nCalled after flush() is completed.\n\n| Parameters ||\n|----------|------------------------------------------------------------------------------------------------------------------------------------------|\n| `sensor` | [Sensor](/reference/kotlin/android/hardware/Sensor)!: The [Sensor](/reference/kotlin/android/hardware/Sensor) on which flush was called. |\n\n**See Also**\n\n- [android.hardware.SensorEventListener2#onFlushCompleted(Sensor)](/reference/kotlin/android/hardware/SensorEventListener2#onFlushCompleted(android.hardware.Sensor)) \n\n### onSensorAdditionalInfo\n\nAdded in [API level 24](https://developer.android.com/guide/topics/manifest/uses-sdk-element.html#ApiLevels) \n\n```\nopen fun onSensorAdditionalInfo(info: SensorAdditionalInfo!): Unit\n```\n\nCalled when a sensor additional information frame is available.\n\n| Parameters ||\n|--------|----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|\n| `info` | [SensorAdditionalInfo](/reference/kotlin/android/hardware/SensorAdditionalInfo)!: A [SensorAdditionalInfo](/reference/kotlin/android/hardware/SensorAdditionalInfo) frame reported from sensor hardware. |\n\n### onSensorChanged\n\nAdded in [API level 24](https://developer.android.com/guide/topics/manifest/uses-sdk-element.html#ApiLevels) \n\n```\nopen fun onSensorChanged(event: SensorEvent!): Unit\n```\n\nCalled when sensor values have changed.\n\n| Parameters ||\n|---------|------------------------------------------------------------------------------------------------------------------------------------|\n| `event` | [SensorEvent](/reference/kotlin/android/hardware/SensorEvent)!: the [SensorEvent](/reference/kotlin/android/hardware/SensorEvent). |\n\n**See Also**\n\n- [android.hardware.SensorEventListener#onSensorChanged(SensorEvent)](/reference/kotlin/android/hardware/SensorEventListener#onSensorChanged(android.hardware.SensorEvent))"]]