Posts

Showing posts with the label permission

Using WRITE SECURE SETTINGS permission on non system apps

Using WRITE SECURE SETTINGS permission on non system apps I happen to frequently use an app that doesnt work if USB Debugging - ADB (Android Debug Bridge) is enabled. It is very cumbersome to go to settings and enable or disable the setting every time I need to use the app. I checked if there are any widgets that could do this in a click and returned empty handed. So, I did what every developer would do - build it myself! In order to change the adb settings, I had to use WRITE_SECURE_SETTINGS permission. But there was one major problem! This permission is not available for non system apps!! The easiest solution to this was to move the apk to /system partition. Except that I didnt want to do this as I frequently keep flashing /system partition. Another solution was to use pm and grant permission to the app like this: adb pm grant <package name> android.permission.WRITE_SECURE_SETTINGS This was great! However I didnt want users who were gonna use the app to go through all this...