Stay organized with collections
Save and categorize content based on your preferences.
SensorPrivacyManager
class SensorPrivacyManager
This class provides information about the microphone and camera toggles.
Summary
Constants |
static Int |
Constant for hardware toggle.
|
static Int |
Constant for software toggle.
|
Public methods |
Boolean |
Checks if the given toggle is supported on this device
|
Boolean |
Checks if the given toggle is supported on this device
|
Constants
TOGGLE_TYPE_HARDWARE
static val TOGGLE_TYPE_HARDWARE: Int
Constant for hardware toggle.
Value: 2
TOGGLE_TYPE_SOFTWARE
static val TOGGLE_TYPE_SOFTWARE: Int
Constant for software toggle.
Value: 1
Public methods
supportsSensorToggle
fun supportsSensorToggle(sensor: Int): Boolean
Checks if the given toggle is supported on this device
Return |
Boolean |
whether the toggle for the sensor is supported on this device. |
supportsSensorToggle
fun supportsSensorToggle(
toggleType: Int,
sensor: Int
): Boolean
Checks if the given toggle is supported on this device
Return |
Boolean |
whether the toggle for the sensor is supported on this device. |
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.
[null,null,["Last updated 2025-02-10 UTC."],[],[],null,["# SensorPrivacyManager\n\nAdded in [API level 31](https://developer.android.com/guide/topics/manifest/uses-sdk-element.html#ApiLevels)\n\nSensorPrivacyManager\n====================\n\n*** ** * ** ***\n\nKotlin \\|[Java](/reference/android/hardware/SensorPrivacyManager \"View this page in Java\") \n\n```\nclass SensorPrivacyManager\n```\n\n|---|--------------------------------------------|\n| [kotlin.Any](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-any/index.html) ||\n| ↳ | [android.hardware.SensorPrivacyManager](#) |\n\nThis class provides information about the microphone and camera toggles.\n\nSummary\n-------\n\n| Nested classes ||\n|---|-----------------------------------------------------------------------------------------------------------------------------------------|\n| | [Sensors](/reference/kotlin/android/hardware/SensorPrivacyManager.Sensors) Sensor constants which are used in [SensorPrivacyManager](#) |\n\n| Constants ||\n|-----------------------------------------------------------------------------------|----------------------------------------------------------------------------------------|\n| static [Int](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-int/index.html) | [TOGGLE_TYPE_HARDWARE](#TOGGLE_TYPE_HARDWARE:kotlin.Int) Constant for hardware toggle. |\n| static [Int](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-int/index.html) | [TOGGLE_TYPE_SOFTWARE](#TOGGLE_TYPE_SOFTWARE:kotlin.Int) Constant for software toggle. |\n\n| Public methods ||\n|------------------------------------------------------------------------------------|----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|\n| [Boolean](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-boolean/index.html) | [supportsSensorToggle](#supportsSensorToggle(kotlin.Int))`(`sensor:` `[Int](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-int/index.html)`)` Checks if the given toggle is supported on this device |\n| [Boolean](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-boolean/index.html) | [supportsSensorToggle](#supportsSensorToggle(kotlin.Int,%20kotlin.Int))`(`toggleType:` `[Int](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-int/index.html)`, `sensor:` `[Int](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-int/index.html)`)` Checks if the given toggle is supported on this device |\n\nConstants\n---------\n\n### TOGGLE_TYPE_HARDWARE\n\nAdded in [API level 33](https://developer.android.com/guide/topics/manifest/uses-sdk-element.html#ApiLevels) \n\n```\nstatic val TOGGLE_TYPE_HARDWARE: Int\n```\n\nConstant for hardware toggle. \n\n Value: 2\n\n### TOGGLE_TYPE_SOFTWARE\n\nAdded in [API level 33](https://developer.android.com/guide/topics/manifest/uses-sdk-element.html#ApiLevels) \n\n```\nstatic val TOGGLE_TYPE_SOFTWARE: Int\n```\n\nConstant for software toggle. \n\n Value: 1\n\nPublic methods\n--------------\n\n### supportsSensorToggle\n\nAdded in [API level 31](https://developer.android.com/guide/topics/manifest/uses-sdk-element.html#ApiLevels) \n\n```\nfun supportsSensorToggle(sensor: Int): Boolean\n```\n\nChecks if the given toggle is supported on this device\n\n| Parameters ||\n|----------|----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|\n| `sensor` | [Int](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-int/index.html): The sensor to check Value is [android.hardware.SensorPrivacyManager.Sensors#MICROPHONE](/reference/kotlin/android/hardware/SensorPrivacyManager.Sensors#MICROPHONE:kotlin.Int), or [android.hardware.SensorPrivacyManager.Sensors#CAMERA](/reference/kotlin/android/hardware/SensorPrivacyManager.Sensors#CAMERA:kotlin.Int) |\n\n| Return ||\n|------------------------------------------------------------------------------------|----------------------------------------------------------------|\n| [Boolean](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-boolean/index.html) | whether the toggle for the sensor is supported on this device. |\n\n### supportsSensorToggle\n\nAdded in [API level 33](https://developer.android.com/guide/topics/manifest/uses-sdk-element.html#ApiLevels) \n\n```\nfun supportsSensorToggle(\n toggleType: Int, \n sensor: Int\n): Boolean\n```\n\nChecks if the given toggle is supported on this device\n\n| Parameters ||\n|--------------|----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|\n| `sensor` | [Int](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-int/index.html): The sensor to check Value is [android.hardware.SensorPrivacyManager.Sensors#MICROPHONE](/reference/kotlin/android/hardware/SensorPrivacyManager.Sensors#MICROPHONE:kotlin.Int), or [android.hardware.SensorPrivacyManager.Sensors#CAMERA](/reference/kotlin/android/hardware/SensorPrivacyManager.Sensors#CAMERA:kotlin.Int) |\n| `toggleType` | [Int](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-int/index.html): Value is [android.hardware.SensorPrivacyManager#TOGGLE_TYPE_SOFTWARE](#TOGGLE_TYPE_SOFTWARE:kotlin.Int), or [android.hardware.SensorPrivacyManager#TOGGLE_TYPE_HARDWARE](#TOGGLE_TYPE_HARDWARE:kotlin.Int) |\n\n| Return ||\n|------------------------------------------------------------------------------------|----------------------------------------------------------------|\n| [Boolean](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-boolean/index.html) | whether the toggle for the sensor is supported on this device. |"]]