0

PermissionQ app home screen

How can PermissionQ app access to the permission screen of another app since there is an answer on a question about permission screen on stackoverflow that it is not possible.

Community
  • 1
  • 1
Aqua760
  • 3
  • 3
  • Does this answer your question? [How to get App's Permission for each app? how to do it programmatically on Android?](https://stackoverflow.com/questions/5385957/how-to-get-apps-permission-for-each-app-how-to-do-it-programmatically-on-andro) – Nizar Jan 15 '20 at 11:51
  • my question is how to display the permission screen when a user click on an app icon from my permission manager application, the current available answers is related to retrieve the permissions of each app and display the general settings of each app not the permission settings of each app, the image above is from a permission manager application that can navigate to permission screen of each app and change the permission without user interaction the user just react with the switch button on the home screen of the app as shown above , – Aqua760 Jan 15 '20 at 13:16
  • Alright, I should have answered your question, let me know if there's anything I missed please. – Nizar Jan 15 '20 at 14:54
  • 1
    thanks for your clarification, i will read about accessibility service and i hope that i will accomplish the task , thanks bro – Aqua760 Jan 15 '20 at 15:13

1 Answers1

0

According to Android Docs, there is a class called PackageManager that can help you take a look at the Installed Packages on your phone. In addition, it has the following method which should answer your question.

getPackageInfo(String packageName, int flags) : Retrieves overall information about an application package that is installed on the system.

When combined with the flag PackageManager.GET_PERMISSIONS, you can retrieve the package's permissions.


Now regarding the actual changing of the Permissions for a certain application, I checked one of the applications that does what you asked about.

What the application has is its own accessibility service that turns off the permissions for you.

So, what happens is

  1. You are sent to the Permissions screen of a certain application, programmatically, through an intent and a package name.
Intent intent = new Intent(Settings.ACTION_APPLICATION_DETAILS_SETTINGS);
Uri uri = Uri.fromParts("package", packageName, null);
intent.setData(uri);
startActivity(intent);
  1. Then the accessibility service they have turns off the specified permission for you. It states that the accessibility service needs to Observe your actions which is probably used to know that the Permissions screen of a certain application opened. Then it uses Retrieve window content to be able to see which checkbox or toggle it needs to activate a press on and interact with.

You have to toggle the accessibility service from your settings, or it does not start. This is the only way I know of that you can do such a thing without root privileges.

Nizar
  • 2,034
  • 1
  • 20
  • 24
  • Please post link and suggestions in comment – Rahul Gaur Jan 15 '20 at 11:54
  • if an existing answer already exists, refer to that (as you have) in the comments, not as an answer – a_local_nobody Jan 15 '20 at 11:55
  • Alright, thanks [a_local_nobody](https://stackoverflow.com/users/4729721/a-local-nobody) and [Rahul Gaur](https://stackoverflow.com/users/7948109/rahul-gaur) for the clarification. Won't happen again. Made it informative instead of linking it to another answer. I saw an answer that was accepted just by linking another answer, thought it would be acceptable. – Nizar Jan 15 '20 at 11:59