Stay organized with collections
Save and categorize content based on your preferences.
OnOpChangedListener
interface OnOpChangedListener
Callback for notification of changes to operation state.
Summary
Public methods
onOpChanged
open fun onOpChanged(
op: String,
packageName: String,
userId: Int,
persistentDeviceId: String
): Unit
Similar to onOpChanged(java.lang.String,java.lang.String)
but includes user and the device for which the op mode has changed.
Implement this method if callbacks are required on all devices. If not implemented explicitly, the default implementation will notify for op changes on the default device only.
If implemented, onOpChanged(java.lang.String,java.lang.String)
will not be called automatically.
Parameters |
op |
String: The Op that changed. This value cannot be null . |
packageName |
String: Package of the app whose Op changed. This value cannot be null . |
userId |
Int: User id of the app whose Op changed. |
persistentDeviceId |
String: persistent device id whose Op changed. This value cannot be null . |
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,["# AppOpsManager.OnOpChangedListener\n\nAdded in [API level 19](https://developer.android.com/guide/topics/manifest/uses-sdk-element.html#ApiLevels)\n\nOnOpChangedListener\n===================\n\n*** ** * ** ***\n\nKotlin \\|[Java](/reference/android/app/AppOpsManager.OnOpChangedListener \"View this page in Java\") \n\n```\ninterface OnOpChangedListener\n```\n\n|----------------------------------------------------|\n| [android.app.AppOpsManager.OnOpChangedListener](#) |\n\nCallback for notification of changes to operation state.\n\nSummary\n-------\n\n| Public methods ||\n|---------------------------------------------------------------------------------------|---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|\n| abstract [Unit](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-unit/index.html) | [onOpChanged](#onOpChanged(kotlin.String,%20kotlin.String))`(`op:` `[String](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-string/index.html)!`, `packageName:` `[String](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-string/index.html)!`)` \u003cbr /\u003e |\n| open [Unit](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-unit/index.html) | [onOpChanged](#onOpChanged(kotlin.String,%20kotlin.String,%20kotlin.Int,%20kotlin.String))`(`op:` `[String](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-string/index.html)`, `packageName:` `[String](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-string/index.html)`, `userId:` `[Int](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-int/index.html)`, `persistentDeviceId:` `[String](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-string/index.html)`)` Similar to [onOpChanged(java.lang.String,java.lang.String)](#onOpChanged(kotlin.String,%20kotlin.String)) but includes user and the device for which the op mode has changed. |\n\nPublic methods\n--------------\n\n### onOpChanged\n\nAdded in [API level 19](https://developer.android.com/guide/topics/manifest/uses-sdk-element.html#ApiLevels) \n\n```\nabstract fun onOpChanged(\n op: String!, \n packageName: String!\n): Unit\n``` \n\n### onOpChanged\n\nAdded in [API level 35](https://developer.android.com/guide/topics/manifest/uses-sdk-element.html#ApiLevels) \n\n```\nopen fun onOpChanged(\n op: String, \n packageName: String, \n userId: Int, \n persistentDeviceId: String\n): Unit\n```\n\nSimilar to [onOpChanged(java.lang.String,java.lang.String)](#onOpChanged(kotlin.String,%20kotlin.String)) but includes user and the device for which the op mode has changed.\n\nImplement this method if callbacks are required on all devices. If not implemented explicitly, the default implementation will notify for op changes on the default device only.\n\nIf implemented, [onOpChanged(java.lang.String,java.lang.String)](#onOpChanged(kotlin.String,%20kotlin.String)) will not be called automatically.\n\n| Parameters ||\n|----------------------|-------------------------------------------------------------------------------------------------------------------------------------------------------|\n| `op` | [String](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-string/index.html): The Op that changed. This value cannot be `null`. |\n| `packageName` | [String](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-string/index.html): Package of the app whose Op changed. This value cannot be `null`. |\n| `userId` | [Int](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-int/index.html): User id of the app whose Op changed. |\n| `persistentDeviceId` | [String](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-string/index.html): persistent device id whose Op changed. This value cannot be `null`. |"]]