In this guide, we will show you the steps to grant WRITE_SECURE_SETTINGS to any Android app. The apps on your device require quite a few different types of permissions to function efficiently. While you could easily grant the likes of notifications, media, storage, and media directly from the Settings menu, the same can’t be said about other higher-level permissions.
These elevated permissions, especially the ability to write settings on your device cannot simply be granted via the Settings menu, instead, you would have to take two different approaches- either gain administrative privileges on your device by rooting it via Magisk or with the help of ADB Commands. Your task would become extremely easy if you opt for the root method as you wouldn’t have to take the help of a PC to carry out this task.
However, it will also bring in quite a few risks and drawbacks, including the tripping of Play Integrity and SafetyNet [not to mention that rooting requires an unlocked bootloader, which will format your device and more importantly might nullify the warranty. On the other hand, if you use the ADB method, then the only drawback [if you would like to call one] is that it will require a PC, but the great thing is that you’ll be saved from all the caveats that root brings in with itself.
[UPDATE: There also exists a non-root ADB method that doesn’t even require a PC, thereby giving you the best of both worlds. This guide has been updated to reflect this method]. So keeping these points in mind, this tutorial will list out a couple of non-root methods that would help you grant the WRITE_SECURE_SETTINGS permissions to an Android app. Without any further ado, let’s check, them out.
How to Grant any Android app WRITE_SECURE_SETTINGS
We have listed two different non-root methods to get this job done: via PC and without PC, along with their perks and drawbacks. Go through each of them once and then out the one that is in sync with your requirements. Before starting with any of the two methods, make sure that the said app is installed on your PC and that you know its app package name as well. As far as the latter is concerned, there exists three different ways through which you could get hold of this information, namely:
Prerequisite: How to Find an App’s Package Name
- Head over to the app’s Settings menu, scroll to the bottom, and the app’s package name will be listed there.
- Download and install Package Name Viewer from the Play Store. Launch it and go to your app, its package name will be listed beneath it.
- Open the app’s listing on the Play Store and copy the content after id= from the URL. For example, the URL for the Facebook app is https://play.google.com/store/apps/details?id=com.facebook.katana, so its package name will be com.facebook.katana
Via PC
It is the easier of the two methods but comes with the obvious drawback of a requirement for a PC every time you want to grant the WRITE_SECURE_SETTINGS permission to an app. If that’s well and good, then let’s get started:
- First off, download and extract Android SDK Platform Tools on your PC.
- Then enable USB Debugging and connect your device to the PC via USB.
- Now type in CMD in the platform-tools folder address bar and hit Enter.
- This will launch the Command Prompt. So type in the below command:
adb devices
- Make sure that you are getting a serial ID, if not, then refer to this guide.
- Finally, execute the below command to grant the permission to the app:
adb shell pm grant app-package-name android.permission.WRITE_SECURE_SETTINGS
- Make sure that you replace app-package-name from the above command.
- For example, to grant the permission to Facebook, the command will be:
adb shell pm grant com.facebook.katana android.permission.WRITE_SECURE_SETTINGS
- You’ll get a prompt on your device [if you used adb shell for the first time].
- So tap on Grant/Allow/OK for the command to be executed successfully.
That’s it. These were the steps to grant WRITE_SECURE_SETTINGS to an Android app using a PC. Let’s now show you how the same could be done without one.
Without PC
- To begin with, download and install Termux on your device.
- Then go to Settings > Apps > Termux > Permission > Give it Storage permission.
- Now download, install, and set up Shizuku on your device.
- Then launch it and tap on Use Shizuku in Terminal Apps > Export Files.
- Now select the desired folder or tap on Create New Folder.
- Give it a name [let’s say Shizuku] and tap Use this Folder.
- Now go to this folder and open the ‘rish’ file via a text editor.
- You may use the Solid Explorer as it comes built-in with a text editor.
- Now replace the PKG keyword with the app package of Termux, which is com.termux.
- Now open Termux and change the directory [via cd command] to the folder where the ‘rish’ file is present.
- In our case, the file is present in Internal Storage > Shizuku folder, so the entire command will be:
cd /storage/emulated/0/Shizuku
- Moving on, now type in the below command:
sh rish
- You’ll get a Shizuku prompt, tap on Allow.
- Then type in the desired adb command in the Termux window [without adb shell keyword] and hit Enter.
- With this, the app has been granted the required permissions and it will be able to carry out the intended task.
That’s it. These were the two different methods that should help you grant WRITE_SECURE_SETTINGS to any Android app. If you have any queries concerning the aforementioned steps, do let us know in the comments. We will get back to you with a solution at the earliest.