0

Here is my class that extends from Thread. I use it for running Shell command:

class ShellCommand extends Thread {

        ShellCommand(MainActivity activity) {}

        public void run() {
            super.run();
            Shell.SU.run("pm grant packagename android.permission.WRITE_SECURE_SETTINGS");
        }
}


locald.start();

if (checkCallingOrSelfPermission("android.permission.WRITE_SECURE_SETTINGS") == 0)
{
    //I want to do something if permission granted. But it says permission denied
}
JpCrow
  • 4,881
  • 4
  • 32
  • 46

2 Answers2

0

first you should know that permission WRITE_SECURE_SETTINGS is not available to andriod apps!

You could get more info by the link

Community
  • 1
  • 1
stackvoid
  • 117
  • 1
  • 2
  • 9
0

In Eclipse:

Window -> Preferences -> Android -> Lint Error Checking. In the list find an entry with ID = ProtectedPermission. Set the Severity to something lower than Error. This way you can still compile the project using Eclipse.

In Android Studio:

File -> Settings -> Inspections Under Android Lint, locate Using system app permission. Either uncheck the checkbox or choose a Severity lower than Error.