1

I have run in adb

adb shell pm grant my.package.name android.permission.WRITE_SECURE_SETTINGS

And there were no errors in terminal. But how I can check if permission android.permission.WRITE_SECURE_SETTINGS via adb been granted

Bob Redity
  • 529
  • 5
  • 14
  • The fact that there were no errors doesn't mean it was granted. Try printing the result of last operation in shell and it will be an error code. Also: [Answer 1](https://stackoverflow.com/questions/13045283/write-secure-settings-permission-error-even-when-added-in-manifest) [Answer 2](https://stackoverflow.com/questions/5034160/how-can-i-get-the-dreaded-write-secure-settings-permission-for-my-android-app) (None of them complete duplicates but the same "issue)". – TheLibrarian Oct 19 '22 at 15:00
  • @TheLibrarian how to print the result of the last operation? – Bob Redity Oct 19 '22 at 15:02
  • `echo $?` but won't really help you. – TheLibrarian Oct 19 '22 at 15:04

1 Answers1

1

You can do something like this

pkg=your.android.pkg'
perm='WRITE_SECURE_SETTINGS'
adb shell dumpsys package "$pkg" | grep "android.permission.$perm: granted=true"

to verify the permission is granted for your package.

Diego Torres Milano
  • 65,697
  • 9
  • 111
  • 134