With reference to this thread I have run into a small problem.
I would like to retrive the permissions of a given app. I have tried to "convert" the code in this link (How to get manifest permissions of any installed Android app) into B4A code. But the Reflection Lib still play tricks on me (combined with limited skills and such... ).
Can someone post code that shows how to get a named app's permissions? Something like:
The code from the link that should do the trick looks like this:
Thanks in advance.
Relevant Links:
Hot to get manifest permissions of any installed Android app - Stack Overflow
PackageInfo | Android Developers
Manifest.permission | Android Developers
I would like to retrive the permissions of a given app. I have tried to "convert" the code in this link (How to get manifest permissions of any installed Android app) into B4A code. But the Reflection Lib still play tricks on me (combined with limited skills and such... ).
Can someone post code that shows how to get a named app's permissions? Something like:
B4X:
Sub GetAppPermissions(sAppName As String) As List
End Sub
The code from the link that should do the trick looks like this:
B4X:
final Intent mainIntent = new Intent(Intent.ACTION_MAIN, null);
mainIntent.addCategory(Intent.CATEGORY_LAUNCHER);
final List pkgAppsList = getPackageManager().queryIntentActivities(mainIntent, 0);
for (Object obj : pkgAppsList) {
ResolveInfo resolveInfo = (ResolveInfo) obj;
PackageInfo packageInfo = null;
try {
packageInfo = getPackageManager().getPackageInfo(resolveInfo.activityInfo.packageName, PackageManager.GET_PERMISSIONS);
} catch (NameNotFoundException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
String[] requestedPermissions = packageInfo.requestedPermissions;
}
Thanks in advance.
Relevant Links:
Hot to get manifest permissions of any installed Android app - Stack Overflow
PackageInfo | Android Developers
Manifest.permission | Android Developers
Last edited: