Stay organized with collections
Save and categorize content based on your preferences.
AppOpsManager.OnOpChangedListener
public
static
interface
AppOpsManager.OnOpChangedListener
android.app.AppOpsManager.OnOpChangedListener
|
Callback for notification of changes to operation state.
Summary
Public methods
onOpChanged
public abstract void onOpChanged (String op,
String packageName)
Parameters |
op |
String |
packageName |
String |
onOpChanged
public void onOpChanged (String op,
String packageName,
int userId,
String persistentDeviceId)
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](/guide/topics/manifest/uses-sdk-element#ApiLevels) \n\nAppOpsManager.OnOpChangedListener\n=================================\n\n*** ** * ** ***\n\n[Kotlin](/reference/kotlin/android/app/AppOpsManager.OnOpChangedListener \"View this page in Kotlin\") \\|Java\n\n\n`\npublic\nstatic\n\n\ninterface\nAppOpsManager.OnOpChangedListener\n`\n\n\n`\n\n\n`\n\n|-----------------------------------------------|\n| android.app.AppOpsManager.OnOpChangedListener |\n\n\u003cbr /\u003e\n\n*** ** * ** ***\n\nCallback for notification of changes to operation state.\n\nSummary\n-------\n\n| ### Public methods ||\n|------------------|----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|\n| ` abstract void` | ` `[onOpChanged](/reference/android/app/AppOpsManager.OnOpChangedListener#onOpChanged(java.lang.String,%20java.lang.String))`(`[String](/reference/java/lang/String)` op, `[String](/reference/java/lang/String)` packageName) ` |\n| ` default void` | ` `[onOpChanged](/reference/android/app/AppOpsManager.OnOpChangedListener#onOpChanged(java.lang.String,%20java.lang.String,%20int,%20java.lang.String))`(`[String](/reference/java/lang/String)` op, `[String](/reference/java/lang/String)` packageName, int userId, `[String](/reference/java/lang/String)` persistentDeviceId) ` Similar to [onOpChanged(java.lang.String, java.lang.String)](/reference/android/app/AppOpsManager.OnOpChangedListener#onOpChanged(java.lang.String,%20java.lang.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](/guide/topics/manifest/uses-sdk-element#ApiLevels) \n\n```\npublic abstract void onOpChanged (String op, \n String packageName)\n```\n\n\u003cbr /\u003e\n\n\u003cbr /\u003e\n\n| Parameters ||\n|---------------|-----------------|\n| `op` | `String` \u003cbr /\u003e |\n| `packageName` | `String` \u003cbr /\u003e |\n\n### onOpChanged\n\nAdded in [API level 35](/guide/topics/manifest/uses-sdk-element#ApiLevels) \n\n```\npublic void onOpChanged (String op, \n String packageName, \n int userId, \n String persistentDeviceId)\n```\n\nSimilar to [onOpChanged(java.lang.String, java.lang.String)](/reference/android/app/AppOpsManager.OnOpChangedListener#onOpChanged(java.lang.String,%20java.lang.String)) but includes user and the device for\nwhich the op mode has changed.\n\nImplement this method if callbacks are required on all devices.\nIf not implemented explicitly, the default implementation will notify for op changes\non the default device only.\n\nIf implemented, [onOpChanged(java.lang.String, java.lang.String)](/reference/android/app/AppOpsManager.OnOpChangedListener#onOpChanged(java.lang.String,%20java.lang.String)) will not be called\nautomatically.\n\n\u003cbr /\u003e\n\n| Parameters ||\n|----------------------|--------------------------------------------------------------------------------------|\n| `op` | `String`: The Op that changed. This value cannot be `null`. \u003cbr /\u003e |\n| `packageName` | `String`: Package of the app whose Op changed. This value cannot be `null`. \u003cbr /\u003e |\n| `userId` | `int`: User id of the app whose Op changed. \u003cbr /\u003e |\n| `persistentDeviceId` | `String`: persistent device id whose Op changed. This value cannot be `null`. \u003cbr /\u003e |"]]