How to get manifest permissions of any installed Android app

后端 未结 3 1541
梦毁少年i
梦毁少年i 2020-12-01 10:00

Is it possible to get the manifest permissions of any installed Android application?

相关标签:
3条回答
  • 2020-12-01 10:27

    If you have apk file it is very simple just open cmd from start menu and write this command line:

    aapt d permissions D:\dina\app-debug.apk 
    

    take care for the path you write then you can get list from all permissions in this application and package name also like this:

    package: com.example.dinasaif.facebookintegration
    uses-permission: android.permission.INTERNET
    
    0 讨论(0)
  • 2020-12-01 10:28

    Thanks for the hint,got it running with:

    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;
    }
    
    0 讨论(0)
  • 2020-12-01 10:29

    Get installed packages using this.

    final Intent mainIntent = new Intent(Intent.ACTION_MAIN, null);
    mainIntent.addCategory(Intent.CATEGORY_LAUNCHER);
    final List pkgAppsList = context.getPackageManager().queryIntentActivities( mainIntent, 0);
    

    And use the package name to get the info.

    http://developer.android.com/reference/android/content/pm/PackageInfo.html

    0 讨论(0)
提交回复
热议问题