简体   繁体   English

如何获取特定应用程序的许可列表?

[英]How to get list of permission for specific application?

I have an application that gets a list of all installed applications in my device and i have these populated in a spinner. 我有一个应用程序,可获取设备中所有已安装应用程序的列表,并且这些应用程序已在微调器中填充。 I also have the application getting all the permissions for all the installed applications on the phone. 我还让该应用程序获得了手机上所有已安装应用程序的所有权限。 But i am having a problem getting the list of permissions for a chosen application and not all the applications. 但是我在获取选定应用程序而非所有应用程序的权限列表时遇到问题。 How would i go about doing this? 我将如何去做?

I also have the application getting the chosen application from the spinner with a button. 我也有该应用程序通过按钮从微调器中获取选定的应用程序。 I just need to get the permissions from that chosen app? 我只需要从该选定的应用程序获取权限?

Thanks 谢谢

I am not exactly sure what you might have tried already. 我不确定您可能已经尝试过什么。

PackageManager.getPackageInfo() should give you a PackageInfo. PackageManager.getPackageInfo()应该给您一个PackageInfo。 According to the API docs, you need to supply it with the flag GET_PERMISSIONS to return permissions as well. 根据API文档,您还需要为其提供标志GET_PERMISSIONS来返回权限。

You should be able to read them from the returned PackageInfo then. 然后,您应该能够从返回的PackageInfo中读取它们。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM